class AppRoutes extends Component {
render () {
return (
<Suspense fallback={<Spinner/>}>
<Switch>
<Route exact path="/" component={ HomePage } />
<Route exact path="/actions"
component={() => <Actions mode={0}/>}/>
<Redirect to="/dashboard" />
</Switch>
</Suspense>
);
}
}
The constructor of the Actions component is called recursively.
I have also tried
<Route exact path="/actions">
<Suspense fallback={<Spinner/>}>
<Actions mode={0}/>
</Suspense>
</Route>
But this just results in the same behaviour. I wish for the Actions component to only be called once rather than repetitively, and to allow props to be passed. How can this be accomplished?