I was trying to pass a component as prop s to make authenticated routes, but inst working, i tried to search on documentation how to do it or in the web, but unfortunately i didnt found. So heres is my component
import { useSelector } from "react-redux"
import { Redirect, Route as ReactRoute } from "react-router-dom/cjs/react-router-dom.min"
export const Route = ({isPrivate=false, Component, ...rest}) =>{
const { acessToken } = useSelector(store=>store)
return(
<ReactRoute {...rest} render={()=> isPrivate === !!acessToken ? <Component/> : <Redirect to={isPrivate ? '/' : '/dashboard'}/>} />
)
}
Can anyone give me a hint on this ?