React Shop is a React hooks based demo e-commerce application. Main purpose of the application to showcase how to integrate react-hooks, react-toolkit, react-redux react-bootstrap and react-route.
Local setup
npm install
npm start
GitHub Live Page - React-Shop
Used Redux-Toolkit and Redux-Thunk for state management of React Shop Application.
- React-Redux hooks API - useSelector and useDispatch to interact with store.
- Redux-Toolkit API for state management.
Benefits of using state management -
- Centralized single store which act as source of truth for whole application state.
- No prop-drilling.
- Business logic at Redux layer.
- Easy to scale and refactor application.
Benefits of using redux-toolkit -
- Commonly required utility packages are included and configured in redux-toolkit.
- nanoid
- Redux-Thunk
- Redux-Devtools
- immer
- Reselect
- NgRx and more
- No need to handle default return in reducers.
- Automatically create action type and static action creator. CreateSlice API
- Reducer uses immer draft state to avoid accidentally mutation state in a reducer.
- Easy approach to handle thunk action creator asynchronous request lifecycle. createAsyncThunk API
- Many more features to handle common use cases encounter in application development.
-
Base project created using React Hooks with no state management.
-
Used Redux and React-Redux connect HOC - mapStateToProps and mapDispatchToProps for state management.
-
Used Redux and React-Redux Hooks for state management.
-
Used Redux-Toolkit and React-Redux Hooks for state management.