Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useEffect does not trigger when a route is popped #457

Closed
laeeqFaiz opened this issue Jan 29, 2025 · 1 comment
Closed

useEffect does not trigger when a route is popped #457

laeeqFaiz opened this issue Jan 29, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request needs triage

Comments

@laeeqFaiz
Copy link

Is your feature request related to a problem? Please describe.
I have useEffect hook in parent route. When I push a child route and pop it back to parent route containing useEffect, it does not detect any dependency changes and hence does not rerun the code inside useEffect.

Describe the solution you'd like
Can we make the useEffect run again when a child route is popped?

@laeeqFaiz laeeqFaiz added enhancement New feature or request needs triage labels Jan 29, 2025
@laeeqFaiz laeeqFaiz changed the title useEffect does not drigger when a route is popped useEffect does not trigger when a route is popped Jan 29, 2025
@rrousselGit
Copy link
Owner

That's normal.

You need to listen to those stare changes. You can use useState or useValueListenable or other things.
You need something that'll trigger a state change on the parent route

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

No branches or pull requests

2 participants