0
I’m trying to create private routes with ReactJs, but always gives the same error, I’ve been on several sites and always do according to each tutorial, but still the same error continues:
My code is this:
const PrivateRoute = ({ component: Component, ...rest }) => (
<Route
{...rest}
render={props =>
isAuthenticated() ? (
<Component {...props} />
) : (
<Redirect to={{ pathname: "/", state: { from: props.location } }} />
)
}
/>);
this is already one of the ways I found on a site, the error that is:
Could someone help me with this problem?

Blz, it worked here, at first glance it didn’t work looking at the parentheses as you had commented, but still gave error, so I put the isAuthenticated inside the file itself as you put there, so it worked, thanks for the help, I’ve been racking my brain for two days.
– Daniel