- Clone repository.
- Run
npm install
oryarn install
. - Run
npm run dev
oryarn dev
. - Run
npm test
oryarn test
. - Serve
index.html
usinglive-server
or similar.
- Learn the fundamentals of Redux.
We need node
& npm
. VSCode's eslint
extension is recommended. Command line commands are run inside the project folder. This guide uses npm but should work the same using yarn.
- Install the project and install redux devtools.
- React docs: lifting state up.
- Limitations and problems when lifting state up.
- Flesh out example using react component state:
- A
Person
component hasphysicalHealth
andmentalHealth
slices of state. - There is a
winLottery
method that improves both slices of state. - There is a
slipOnBananaPeel
method that worsensphysicalHealth
. - There is a
watchTheNews
method that worsensmentalHealth
. - Start a redux store in
App.jsx
initializing hard-codedphysicalHealth
andmentalHealth
. - Wrap
Container
insideApp.jsx
with theProvider
given byreact-redux
, passing the store. - See redux devtools working with the hard-coded slices.
- Create reducing functions for each slice of state explaining requisites for reducers.
- Refactor
App.jsx
to usecombineReducers
and the new functions. - Refactor
Person
to delete local state andthis.setState
logic. - Connect the
Person
component to have access to the store. - Refactor
Person
to dispatchSLIP_ON_BANANA
etc usingthis.props.dispatch
. - Refactor
Person
to use pre-defined action creators. - Explain
mapStateToProps
.