Use RedwoodJS Link and routes Object to Navigate

Share this video with your friends

Send Tweet

RedwoodJS provides a Link component that we can use to navigate around our app. We can provide a to prop with the path that we want to navigate to.

RedwoodJS takes this a step further and provides a routes object from @redwoodjs/router. This object is aware of all the routes defined in web/Routes.js. This allows us to use the methods on this object rather than referencing the our routes with a string literal. We can then change the route path without having to change all of the references to that route all over our app.