Hello there.
I was following a tutorial and found myself stuck because I saw the following piece code:
if (!user) {
return (
<Redirect
to={{
pathname: 'signin',
state: { from: location },
}}
/>
);
}
This one is React Router v5. Mine is v6 (I use Navigate instead).
I don´t understand how is possible that this piece works:
pathname: 'signin'
I cannot make this work without without slash ("/signin"), variables (with slash) or passing props… And I am wondering how can someone make this work.
I was checking the documents for React Router and all examples contain slashes, but then I´ve seen more code online where they don´t use it.
Does anyone know why?