My react component looks like this:
class App extends React.Component {
render() {
debugger;
if(!this.props.isUserExist) {
return (
<div>
<Route exact path="/" component={DashboardPage} />
</div>
);
}
return (
<div>
<Switch>
<Route exact path="/" component={HomePage} />
<Route exact path="/list" component={ListPage} />
<Route component={NotFoundPage} />
</Switch>
</div>
);
}
}
My question is: is there a better way to check these conditions with react router v4? is this the best way to check these conditions? Is this the best practice? Please someone help me with this!