Navigating Routes Programmatically7:01 with Guil Hernandez
There may be times when you'll need to programmatically change the path in the URL. A common example is changing the path in response to a form submission. In this video, you'll learn how to navigate users to a URL created by the values they type into a form.
Accessing the History Object
Depending on how your application is set up, you might need to import withRouter into your component in order to access the history object’s properties.
<form> <input type="text" placeholder="Name"/> <input type="text" placeholder="Topic"/> <button type="submit">Go!</button> </form>
Related courses and workshops
You need to sign up for Treehouse in order to download course files.Sign up