Enable Routing in Typescript Create React App

When working with Create React App using the Typescript configuration, there’s a slight change to be made to set up the ability to perform routing.

Install the following into your project:

npm i -S react-router-dom @types/react-router-dom

After that’s done, use the content in the Example Page in your App.tsx file. You should be able to change between pages using the URL as reference.

Reference:

https://create-react-app.dev/docs/adding-a-router/

Leave a Reply

Your email address will not be published. Required fields are marked *