Triggering State changes in parent layout from child component
Unanswered
Tufted Flycatcher posted this in #help-forum
Tufted FlycatcherOP
The next docs says: Passing data between a parent layout and its children is not possible. However, you can fetch the same data in a route more than once, and React will automatically dedupe the requests without affecting performance. (https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) but is there a work around for this or updates coming in the future? I want to trigger my setter function that lives in my root layout in next13, from my child component.
1 Reply
@Tufted Flycatcher The next docs says: Passing data between a parent layout and its children is not possible. However, you can fetch the same data in a route more than once, and React will automatically dedupe the requests without affecting performance. (https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) but is there a work around for this or updates coming in the future? I want to trigger my setter function that lives in my root layout in next13, from my child component.
The current solution to do that is to store the state in the URL, so it can be read from the server (running the server components)