I am using redux and reactjs. I need to add few function in componentDidMount() to the following root react component.
I am not using react class extend. How can I apply componentDidMount() and my logic there?
const App = () => (
<div>
<NavigationContainer />
</div>
)
export default App
You can wrap the JSX in a return call and simply do your logic before, even interacting with your redux store.
const App = () => {
const willRunOnEachRender = 'runs on each render'
return (<div>
<NavigationContainer willRunOnEachRender={willRunOnEachRender} />
</div>
)
}
export default App
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With