Components are mounted twice
See original GitHub issueVersion
- react-native-router-flux v4.0.6
- react v16.6.1
- react-native v0.57.5
- ios 12.x
Expected behaviour
Navigate back to a component and navigate back again. Didmount should be executed once.
Actual behaviour
Navigate to the component again immediately after a component back , it should not cause the component to be mounted twice .
Steps to reproduce
Navigate from “home” to ”productList“
<Router style={styles.container}>
<Modal key='modal' hideNavBar>
<Stack key='root'>
<Tabs key='tabs'
initial
hideNavBar>
<Scene key='home' tabBarLabel='home' title='home' component={Home}/>
<Scene key='profile' tabBarLabel='profile' title='profile' component={Profile}/>
</Tabs>
<Stack key='productList' title='productList' component={ProductList}/>
</Stack>
</Modal>
</Router>
Reproducible Demo
The official demo can reproduce this bug
I think this may be because I re-entered the component immediately after exiting the component.
My English is not very good, I hope you can understand, God bless 🙏
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10
Top Results From Across the Web
React Component Mounting Twice - Stack Overflow
I use NextJS and I had reactStrictMode: true, which causes each component to mount twice (on purpose, in dev, for debugging help.. not...
Read more >React App mounting twice ? : r/react - Reddit
Did you know React 18 mounts a component twice now? It's not a matter of not understanding how effects work, it's just a...
Read more >App mounting twice in dev mode · Issue #12363 - GitHub
This is caused by rendering the component inside React Strict Mode, to fix this remove the <React.StrictMode> tag from the root of your...
Read more >React Components rendered twice — any way to fix this?
Let's find out if there is a way to avoid this problem by trying different implementations. A) Functional Component with useState. function App()...
Read more >Component is mounted twice - why? - Get Help - Vue Forum
I have just discovered this issue in console where most of my components are mounted twice mounted(){ console.log("ComponentName mounted.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also facing the same issue with “react-native-router-flux”: “4.0.6”
👍 same here. in fact the initial scene component in a nested stack loaded for the first time is also mounted twice. @aksonov this is deal-breaking for us in using this library. Could you please help?