Next.js Discord

Discord Forum

passing data to children

Answered
Mud-daubers posted this in #help-forum
Open in Discord
Mud-daubersOP
hey guys, for next js app router, (specifically the layout.js file) - is it possible to pass data to the children? for example right now im calling the same endpoint e.g., '/api/user' on each page to get the users detail. Is there a more efficient way to do this, e.g., just call it once and pass it to the children the data recieved
Answered by @ts-ignore
you can create a context and then use the data from there
View full answer

1 Reply