In both functions above, we are returining a new object with ...state. In the DASHBOARD_EDIT_ITEM handler we fetch editItemIndex from the action.payload object and write into index variable.

The rest of the code should be self-explanatory.

Changes in (you can click the diffs image to make it larger):
src/routes/Dashboard/containers/DashboardContainer.js

Above we have simply added the functions that were created in the Dashboard/modules/dashboard.js file so we import dashboardAddItem and dashboardEditItem .. Now we have to get our function in our statefull Dashboard component:

source of src/routes/Dashboard/components/Dashboard.js

And here we call the parent's method this.props.updateItem for resfresh the redux state:

source of src/components/Dashboard/Dashboard.js

On the above code base, we have added new functions called onChangeInput, onSubmit and itemOnEdit so we need to improve our skeleton as well:

Explanation of onClick callback: In the Dashboard view (/src/components/Dashboard/Dashboard.js) we prepare a method this.itemOnEdit, which returns a method with added before 'hidden' property (i parameter - see above). It's called a closure. Here is an example

... so now it makes an edited item bold and underlined.

Next we have improved the render function of Dashboard component (/src/components/Dashboard/Dashboard.js):

We have added a standard form and inputs - they are communicating with state object the use of callbacks (the value={this.state.inputValue} and onChange={this.onChangeInput} will take care of it). The submit button value is determined by the this.state.editedItemIndex - so if it is a null then that means that a user hasn't clicked any item, yet.

This is the end results of all the changes we've made above:

Source of the commit's screenshots:
https://github.com/ReactPoland/reactjs-redux-tutorial/commit/chapter-5