When triggered by the Route doesn't change, only the URL does.ĭispatching redux actions or calling push on the history itself have the same behavior as only Link works. Trigger ('/links/add') and the Layout will display the new URL but the page doesn't update (it's still LinksPage instead of AddLinkPage) Expected Behavior Had no luck with the regular history.Ĭlick on the Link and the Layout will display the new URL and the correct page. The useHistory hook helps us to access the history object, which is used to navigate programmatically to other routes using push and replace methods. If your are new to hooks checkout my react hooks introduction tutorial. LinksPage has both a Add new and ('/links/add') Steps to reproduce Learn, how to use the useHistory hook in react-router. Import from "react-router-redux" import createHistory from 'history/createHashHistory' const history = createHistory ( ) render (, document.
0 Comments
Leave a Reply. |