Closed as not planned
Description
openedon Nov 22, 2023
What is the new or updated feature that you are suggesting?
There should be a way of disconnecting from redux, which prevents both re-calculation of selector result and re-rendering of the component.
Why should this feature be included?
The main issue of bad performance of apps that use react-navigation
or its analog with keeping components mounted when you switch them (like tab navigation or stack navigation) is subscription to redux. Especially relevant for React Native apps (Any app with tab bar and/or navigation stack).
Similar issue was created for mapStateToProps
once upon a time.
What docs changes are needed to explain this?
There should be a new option in useSelector, smth like:
useSelector(selector, {
...
enabled: boolean // when false, selector is not re-evaluated and component is not rerendered. default is true
})
Can be used like:
const isFocused = useIsFocused() // react-navigation hook
const data = useSelector(dataSelector, { enabled: isFocused })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels