A hands-on learning project to master Redux, React, and modern state management patterns. This project demonstrates core Redux concepts, custom implementations, and best practices.
- Project Overview
- Features
- Learning Outcomes
- Learning Modules Breakdown
- Project Structure
- Tech Stack
- How to Run
This project is a comprehensive exploration of Redux and state management in React. It covers everything from basic reducers to advanced patterns like the DUCK pattern, custom Redux store implementations, and even a custom React-Redux connector. The app simulates a simple e-commerce experience with product listing, cart, and wishlist functionality, and is structured to facilitate learning and experimentation.
This website is a demo e-commerce platform that showcases a variety of products. Users can:
- Browse a list of products with detailed information
- Add products to their cart or wishlist
- Remove products from the cart or wishlist
- Adjust product quantities in the cart
All these features are powered by Redux for robust and predictable state management, ensuring a seamless and responsive user experience.
- Product listing with detailed information
- Add/remove products to cart and wishlist
- Adjust product quantities in cart
- Persistent state management using Redux
- Modular React components for UI
- Navigation using React Router
- Clean, scalable code structure
- Step-by-step learning modules for Redux concepts
- Custom Redux store and React-Redux connector implementations
While building this project, the following concepts and skills were learned and applied:
- Array Methods:
map,filter,reducefor transforming and aggregating data (e.g., updating cart/wishlist, calculating totals)
- Redux Fundamentals:
- Actions, reducers, and the Redux store
- Dispatching actions and subscribing to state changes
- Using
combineReducersfor modular state management
- Custom Redux Implementation:
- Built a Redux-like store from scratch to understand its internals
- DUCK Pattern:
- Organized Redux logic using the DUCK pattern for better maintainability
- React Integration:
- Connected Redux with React using
react-redux'sProviderand a custom connector - Used React Router for page navigation
- Connected Redux with React using
- Best Practices:
- Feature-based folder structure
- Clean, readable code and modular components
- Immer Usage:
- Explored reducers with and without Immer for immutable state updates
This project is organized into a series of learning modules, each focusing on a specific Redux or state management concept:
- Introduction to reducers, actions, and the Redux store
- Manual state updates and action dispatching
- Subscribing to state changes and updating the UI
- Building a Redux-like store from scratch (
myCreateStore) - Implementing
dispatch,getState, andsubscribemethods - Understanding the internal mechanics of Redux
- Applying Redux to a real-world scenario (cart, wishlist, products)
- Managing complex state with actions and reducers
- Handling product addition/removal and quantity adjustments
- Using
combineReducersto modularize state management - Splitting logic into separate reducers for products, cart, and wishlist
- Dispatching actions to different slices of state
- Organizing Redux logic using the DUCK pattern (actions, action creators, and reducers in one file)
- Cleaner, more maintainable Redux code
- Using action creators for dispatching
- Writing reducers with manual immutable updates
- Understanding the challenges of immutability in Redux
- Leveraging Immer to simplify immutable state updates in reducers
- Cleaner and more readable reducer logic
- Building a custom
Provider,useDispatch, anduseSelectorhooks - Connecting React components to a Redux-like store without
react-redux - Deepening understanding of React context and hooks
redux-practice/
├── components/ # Reusable UI components (CartItem, Header, Products, WishListItem)
├── pages/ # Main app pages (Home, Cart, WishList)
├── store/ # Redux store, reducers, and product data
├── learning-modules/ # Step-by-step learning modules:
│ ├── 01-basic-redux-concepts/ # Basic Redux concepts
│ ├── 02-custom-redux-store/ # Custom Redux implementation
│ ├── 03-ecommerce-redux-example/ # Cart & wishlist logic
│ ├── 04-combined-reducers/ # Using combineReducers
│ ├── 05-duck-pattern/ # DUCK pattern structure
│ ├── 06-reducers-without-immer/ # Reducers without Immer
│ ├── 07-reducers-with-immer/ # Reducers with Immer
│ └── 08-custom-react-redux-connector/ # Custom React-Redux connector
├── assets/ # Static assets (icons, images)
├── App.js, main.js # App entry and setup
├── index.html # HTML entry point
└── package.json # Project dependencies
- React (v19+)
- Redux (v5+)
- React Redux (v9+)
- React Router DOM (v6+)
- Parcel (for bundling)
- Clone the repository:
git clone <repo-url> cd redux-practice
- Install dependencies:
npm install
- Start the development server:
npm start
- Open http://localhost:1234 in your browser.
This project is a showcase of Redux mastery, custom state management, and clean React architecture. Each module is designed to be a reference for learning and best practices in Redux and React state management.