Home > front end >  Can't assign element with RouteObject in react-router-dom 6
Can't assign element with RouteObject in react-router-dom 6

Time:05-31

I'm trying to create a variable to hold all my routes in react-router-dom v6, and all the documentation seems to imply i should be able to do it like this: enter image description here

but i'm getting compile errors that:

'SPALayout' refers to a value, but is being used as a type here. Did you mean 'typeof SPALayout'?

This is basically the same question as Config route in react-router-dom v6, but I'm guessing it's working for them and not me. What am i doing wrong here?

CodePudding user response:

The mistake here was not having the correct file extension (.tsx). I have added this answer as it was slightly different from Config route in react-router-dom v6.

As it was a file extension issue, I am unsure about marking this as a duplicate.

  • Related