React Router and ES6


I have a React project that I have been working on for months. I am not using any ES6 in it.
Now I need to set up some routing with React-Router and all the instructions I see use ES6 syntax. Is it possible to use React-Router without ES6? Or will I have to change my setup?

Right now the routing does not work at all. I assume it is because of the ES6 syntax, because I don’t see anything else wrong.

1 Like

I believe react-router follows the same versioning as react. Have you tried installing the same version of react-router as the react version you are using?

Otherwise, it could be a problem with React’s ever-changing syntax. Could you show us your code or make a snippet of that part of it on codepen possibly?

Thanks! But I think I figured it out. Turns out I had to do module.exports.default to my components. Not sure why, but it works.

Well, sort of. Now I need to figure out how to pass down props.