![]() Since its empty on the root path, I'm passing all as a fallback to the visible todo list. React Router makes such parameters available to the route handler components in a special prop called params, so I'm adding a params prop to the app, and now I can read the filter from params.filter. We want the filter prop to correspond to the current filter parameter in our route configuration. ![]() The visible todo list component gets rendered from the app, so this is where we need to add the filter prop to make it available in the mapStateToProps function of the visible todo list. I will also change the get visible todos function to use the current convention we use for the filter prop that is all completed or active. I am adding an argument called ownProps to the mapStateToProps function, and I'm going to read the current visibility filter from ownProps. However, the content does not get updated because the visible todo list component in its mapStateToProps function still depends on the visibility filter in the Redux store instead of reading it from the URL. I'm using the links provided by React Router now, so when I click on a link, the URL gets updated.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |