mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
26 lines
1.1 KiB
Markdown
26 lines
1.1 KiB
Markdown
# Step 2.6 - Redux: Dispatching actions and examining state (Exercise)
|
|
|
|
[Lessons](../) | [Exercise](./exercise/) | [Demo](./demo/)
|
|
|
|
## Visualize state changes with Chrome extension
|
|
|
|
If you still have `npm test` running from the previous step, stop it with `ctrl+C`. Start the app by running `npm start` from the root of the `frontend-bootcamp` folder. Click the "exercise" link under day 2 step 6.
|
|
|
|
1. Install the [Redux DevTools extension](https://github.com/zalmoxisus/redux-devtools-extension)
|
|
- [Chrome](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd)
|
|
- [Firefox](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/)
|
|
|
|
2. Hit F12 (`cmd+option+I` on Mac) and open the inspector panel entitled **Redux**
|
|
|
|
3. Modify `exercise/src/index.tsx` to dispatch actions (you're not limited to adding todos; you can also remove and clear)
|
|
|
|
4. Explore the actions' effects using the extension
|
|
|
|
## Playing with dispatching actions inside tests
|
|
|
|
Stop the app using `ctrl+C` and start the tests by running `npm test`.
|
|
|
|
1. Open `exercise/src/reducers/reducer.spec.ts`
|
|
|
|
2. Follow the instructions to fill out the reducer tests
|