Next.js Discord

Discord Forum

passing props through multiple components

Unanswered
Japanese jack mackerel posted this in #help-forum
Open in Discord
Japanese jack mackerelOP
to simplify my "issue" as an example lets say i have 3 components
component
sub-component
sub-sub-component

as im working on my sub-sub-component i need something from component so i have to go through and set up props to pass it to component, recieve, it and pass it down again

while this isnt the worst it is becoming a hastle when im setting up a new sub sub sub component and need something from component and have to handle it all
is there any simple way that i can get a prop from a top level component to a lower one? especially as components like sub-components are now accccepting 10-15 vars

4 Replies

You can create a context for passing data if it's client side
@Japanese jack mackerel as JJSenpai said, use context, or url params for passing around data over multiple components
@Arinji <@566121809087430657> as JJSenpai said, use context, or url params for passing around data over multiple components
Japanese jack mackerelOP
hmm reading useContext seems like it could work although even after reading the docs my brain doesnt fully understand it xd