Next.js Discord

Discord Forum

what is the standard way to pass down props to composable UI components?

Unanswered
British Shorthair posted this in #help-forum
Open in Discord
British ShorthairOP
if you have a composable ui component thats something like this

<Container>
 <ContainerContent>
  ... children
 </ContainerContent>
</Container>


If Container has props, and you need to pass some down to ContainerContent, is it bad practice to use React.cloneElement(props.children, { aProp }) to pass down props

or is there a more standard approach to this? do most people use context instead?

0 Replies