Closed rumbogs closed 6 years ago
You can avoid this either by using React.PureComponent
, or passing initialState
to createStore
directly instead of setting it in the reducer. The instructions will be updated soon, but as it stands we’ve integrated a function to create a default reducer that does initialize an undefined state by default. We do this to support the use case where people don’t specify their initialState
to createStore
.
Using:
On first load, the Home Screen is mounted twice:
App.js
middleware.js
RootTab.js
HomeStack.js
Home.js
NavReducer.js
When starting the app, the debugger displays 2 console logs of
render
anddid mount: HOME
.I'm expecting to only render once, as the default React Navigation behaviour, without Redux.
Edit: Seems that not calling setting
state
toinitialState
in the NavReducer fixes this, if that is the issue, please update documentation on Redux Integration on https://reactnavigation.org/docs/redux-integration.html