mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
Step 2.7
Connect store to view with react-redux. connect() is used to turn Redux store and dispatch functions into props inside React components. The state and action dispatchers are passed along with a <Provider> component.
Exercise
-
open up
exercise/src/index.tsxand wrap<TodoApp>with<Provider>as instructed in the comment -
open up
exercise/src/components/TodoFooter.tsxand erase the "nullable" type modifier (i.e. the ?) in the interface definition ofTodoFooterProps -
uncomment the bottom bits of code and fill in the implementation for
mapStateToProps()andmapDispatchToProps()- feel free to useTodoListItem.tsxas a guide -
do steps 2 and 3 for the
TodoHeader.tsxfile