Routing in MERN stack

Since freeCodeCamp curriculum doesn’t teach it, I’m kind of lost. I read some things about react router dom, react router redux or maybe just with the express API route it more than enough?

I really appreciate anybody’s help.

Kind regards.

Hey there,

I think react-router-dom is the easiest way to learn it.
It handles your routing (the path in your URL) on the frontend.
Express API routes handle your routing on your server / API.
You should learn both.


The workflow of react-router-dom is:

  1. you create a visible Link in your app (a user can click on it, like a HTML a)
  2. you create a Route in your app that tells the router which React component it should render for a specific route (from the Link above)

You can see a simple example in the docs.
You can see that for every to attribute in a Link there is a path in a Route.