Tech Blog

Simple Routing Example

This project shows one simple example of how the router can be used to set up multiple pages within a tile. This project can be found in the Developer Network GitHub account: https://github.com/ExLibrisGroup/campusm-aek/tree/master/routes.

File Walk-Through

screen/screen.js

This file shows how you can set up multiple routes and associate them with “pages.” In your page component, you will set the prop named “path.” You will be able to use this path within other pages to redirect your user.

home.js

This file shows the initial page that is rendered on the screen. It includes a simple button that redirects the user to the second page. The router defined in screen/screen.js is being accessed on this page to redirect the user.

pagetwo.js

This file shows the second page that is rendered once the button on the home page is clicked. It also includes a simple button that can redirect the user back to the home page (you can start to see how you could use these routes in a nav bar).

Screenshots

Once the project is up and running it will show these two very simple pages:

      

Voilà! Happy routing!

Leave a Reply