Building a form using Redux Form
Redux Form is typically used for large forms or steps forms because it has a Redux state to keep the values through the entire form. Also, Redux Form is handy to validate the data and efficiently handle the submission.
Getting ready
For this recipe, we need to install Redux Form as follows:
npm install redux-form
How to do it...
For this recipe, we are going to make the same Todo List, but this time using Redux Form:
- Once we've installed Redux Form, we need to do some modifications to the code of the last recipe to implement Redux Form. The first thing we need to do is to add a reducer for our forms. For this, we need to import a reducer from
redux-form
, and we can change the name of the variable toformReducer
to be more explicit, and then add the reducer as a form into ourcombineReducers
, as shown in the following code:
// Dependencies import { combineReducers } from 'redux'; import { reducer as formReducer } from 'redux-form'; // Components Reducers import...