In the first part of the lecture, we'll talk about what Redux is, when it is useful, and some key concepts around using Redux.
Check the INTRO.md file for more!
There is a lot of new terminology to learn in Redux; use this Redux Cheat Sheet made by former Flatiron instructor Alex Griffith as a handy reference in case you need a refresher on any content from these lectures.
- Playlist
- Part 1: What is Redux?
- Part 2: Core Concepts
- Part 3: Message Passing
- Part 4: Reducer and Dispatch
- Part 5: Using Redux
- Part 1 Slides
- Part 2 Slides
- Understand why Redux is useful
- Explain what a pure function is
- Explain the pattern / technique of message passing
- Refactor a component's behavior to use message passing
- Install the redux library so it can be used in a project.
- Create a
store
in redux with some defaultstate
. - Create a
reducer
to changestate
based on anaction.type
. - Use
dispatch
to send anaction
to thestore
to make changes tostate
. - Read
state
in thestore
.
In the 2nd part of the lecture, we go over connecting Redux to React using react-redux
and using some common functions from the react-redux
library to let our components interact with the Redux store.
- Playlist
- Part 1: Provider, connect, and mapStateToProps
- Part 2: mapDispatchToProps
- Part 3: connect with Multiple Components
- Part 4: React Redux Hooks
- Install the
react-redux
library so it can be used in a project. - Make the
store
available to their application by using theProvider
component. - Use
connect
to give components the ability to listen for changes to thestore
. - Use
dispatch
in a React component. - Use
mapStateToProps
to read data from thestate
in the Reduxstore
. - Use
mapDispatchToProps
- Bonus Use action creators & object form of
mapDispatchToProps
- Bonus React-Redux hooks:
useSelector
anduseDispatch
We'll add redux
to a React project and go through all the necessary setup. We'll also talk about code organization, as well as some additional tools such as redux-thunk
for working with fetch
and redux
, and the Redux DevTools.
- Playlist
- Part 1: Project Overview
- Part 2: Basic Setup
- Part 3: Reading State - mapStateToProps and useSelector
- Part 4: Updating State - mapDispatchToProps
- Part 5: Updating State - useDispatch
- Part 6: More dispatching
- Part 7: Redux DevTools
- Part 8: combineReducers
- Part 9: Action Creators
- Part 10: Redux Thunk
- Part 11: More thunk
- Part 12: Code Organization + Wrap Up
- Set up a project with Redux and React-Redux
- Organize Redux code
- Use Redux DevTools
- Install the
redux-thunk
library - Use
applyMiddleware
from the redux library andthunkMiddleware
from the redux-thunk library - Create action creators that return functions in order to dispatch asynchronously
- Discuss best practices of action architecture when using thunk