Closed coreylight closed 4 years ago
At first glance I ... have no idea what is going on here!
React strict mode will double invoke certain lifecycle methods, it is a feature to help figure out issues in an application. Those methods are constructor, render, setState, getDerivedStateFromProps. https://reactjs.org/docs/strict-mode.html.
I think the root cause is the side effect in menu reducer. The reducer calls callbacks (i.e. onSelect). However in Concurrent React, we cannot guarantee internal React hooks (esp. useState, useReducer) to run only once.
🐛 Bug report
Current Behavior
StrictMode
componentExpected behavior
Reproducible example
https://codesandbox.io/s/pedantic-varahamihira-i5e0f
StrictMode
Suggested solution(s)
??
Your environment
0.7.3
16.12.0