Comments (6)
The link is old. Yes there's a problem, I'll solve it as soon as I can.
Need to have a proper dev setup first (if you want to help => #28)
from hooks.
I get an infinite loop if I pass navigate
as a dependency to useEffect
since the function changes on every render
function ReactComponent() {
const {navigate} = useNavigation();
useEffect(() => {
if (user) {
navigate(...)
}
}, [user, navigate])
return null
}
Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
My solution, for now, is to not pass navigate
as a dependency, but the hooks eslint rule complains and it seems less than ideal. I'm assuming the caching you describe would solve this?
The link you posted is broken FYI
from hooks.
Oh, actually navigate() comes from the ReactNavigation context, so it should rather be cached in core
from hooks.
@cmmartin the original issue is not totally related to your problem. I've opened a new issue in core for that: https://github.com/react-navigation/core/issues/71
The original issue will be fixed by #3
from hooks.
should be fixed by release 1.0.3 and #38, please tell me if everything works
from hooks.
@cmmartin ,relative to this issue: https://github.com/react-navigation/core/issues/71
Can you help us understand what you are trying to achieve exactly with the following code?
function ReactComponent() {
const {navigate} = useNavigation();
useEffect(() => {
if (user) {
navigate(...)
}
}, [user, navigate])
return null
}
Is it something related to switching from authenticated / non authenticated navigators?
from hooks.
Related Issues (20)
- Proper way to use react-navigation-hooks with storybook HOT 2
- Types are missing and causing errors HOT 18
- react-navigation-hooks v2 HOT 2
- setTopLevelNavigator support for hooks HOT 2
- Getting error 'from' expected HOT 2
- useFocusEffect should not retrigger on re-render HOT 8
- I can't define NavigationParams types with useNavigation HOT 1
- Reset Stack HOT 1
- Proposal: Ability to pass params for tabBarOnPress defaultHandler function HOT 1
- setParams entity change when is called HOT 1
- useFocusEffect should handle drawers HOT 4
- useNavigation shouldn't be in @react-navigation/native? HOT 3
- Open&Close Drawer HOT 1
- Hooks on the web - react-navigation is now directly imported HOT 3
- useNavigation give the warning "can't perform a React state update on an unmounted component" HOT 1
- Can I reproduce events like "onEnter/onExit" ? HOT 6
- "THIS ISSUE WAS DELETED AND BLOCKED"
- Include v5 patching for users converting from v4 to v5? HOT 1
- useNavigation not working HOT 1
- How i can re-render with useNavigationParam ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hooks.