React passing props, to all subcomponents does not apply to React.cloneElement

problem recovery

I have a component called < Father > that generates new data. How do I pass that data to its subcomponents? (do not know the name of the subcomponent, do not use React.cloneElement)

reasons for not using React.cloneElement

React.cloneElement copies and creates a new element. It is too inefficient when it is done many times, and I hope to find a way to pass the value directly. Ask the great god for an answer! Thank you so much!

Aug.16,2021

consider using the context function of React. All child components can access the content given by the parent component at any time


  reference  

Menu