Proposed changes
The aim of this pull request is to add reducer and actions to the project
The following setups were implemented
-
Add Redux Toolkit(npm install react-redux @reduxjs/toolkit).
-
Structure your application files using a "feature folder" approach and use the ducks pattern for your Redux files. Your files/folder structure could look like this:
...
/src
|---/components
|---/redux
|--- /books
| books.js
|--- /categories
| categories.js
| configureStore.js
| index.js
-
Write your book's actions and reducer (in /src/redux/books/books.js) using the ducks pattern.
-
Define action types for adding and removing a book.
-
Set the initial state to be an empty array of books.
-
Export Action Creators for your actions.
-
Write your reducer and export it as default.
-
Define state changes for the actions that you created.
-
In case of unknown action - return the current state.
-
Write your categories actions and reducer (in /src/redux/categories/categories.js) using the ducks pattern.
-
Define an action type for checking the status.
-
Set the initial state to be an empty array of categories.
-
Export Action Creators for your actions.
-
Write your reducer and export it as default.
-
For the check status action return a string "Under construction".
-
In case of unknown action - return the current state.
-
Configure the Redux Store (/src/redux/configureStore.js):
-
Importing the necessary methods from Redux Toolkit.
-
Combine both reducers into a root reducer by using configureStore function.
Type of change
Checklist