Thursday, January 5, 2023

72/365: React Router Deep Dive pt 2: Links

 React Router navigation is handled through the Link component. The Link replaces the old fashioned anchor tag and has a number of optional properties. One of them is the "replace" property, which changes the behaviour of the browsers back button. With this property the page is completely removed from the users history and a back will send the user back two links instead of one. This is useful for things like a login screen, where if a user logs in and then clicks the back arrow they should be sent back to the home page instead of back to the login screen. Another property is the reloadDocument property, which reloads the entire page like a traditional HTML anchor tag. The state property allows you to pass state data along your link which importantly is not in the apps URL. 



No comments:

Post a Comment

190: Sablier

 The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...