Handling history in React.js

Handling history in React.js is not very much different from other languages. A top level component should hold the state of the app in this.state. If a URL is changed or any such event occurs you will get the event from the router then you call setState to update the top-level components state. Make sure to call the routers navigate method to update the URL if you update the state yourself. There is another option with React.js is to use its router component. You can dynamically change the available routes as needed since it handles pushState for you. It is a react class. This method seems like it doesn’t work well with browser based approach. When it comes to client side route handling as long as your Url always directs to one application state and one state only the back and forward buttons will work well and how you reach that particular URL should’t matter.