Skip to content

Refreshing parent route data from child route #10361

Closed Answered by brophdawg11
ngunna asked this question in Q&A
Discussion options

You must be logged in to vote

manipulates some data which happens to be displayed in the parent component

Are you manipulating via an action (<Form method="post">, useSubmit, fetcher.submit)? If so, all loaders should revalidate by default and you can use shouldRevalidate to opt out of revalidation on certain active loaders if they do not need to be refreshed based on the data mutation.

If you're not mutating via the built-in APIs, I would suggest trying that first. But if you need to mutate outside of the react-router APIs, then you will need to manually revalidate via useRevalidator and can again leverage shouldRevalidate to opt-out of revalidation for certain loaders.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@ngunna
Comment options

Comment options

You must be logged in to vote
3 replies
@ngunna
Comment options

@brophdawg11
Comment options

@ngunna
Comment options

Answer selected by ngunna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants