Say I have a main component which uses 2 sub components and i want to pass a styling object prop to those sub components. Is there a way of passing those props without passing them directly to the main component since those props are not directly assosiated with the main component but rather the sub components.
<MainComponent subComponentStyling={} />
I reckon I'd be able to do this where I pass the sub components down as children:
<MainComponent>
<SubComponent1 style={} />
<SubComponent1 style={} />
</MainComponent>
On the other hand those two sub components are tightly connected to main component since I will always pass multiple props from the main component to the sub components, so I can't really do the above since the functionality that I want to pass down exists in the main component.
Do I have to create a render prop and pass stuff down through that or is it more convient to pass the styling props down to main component and from main component to the sub component?
I'm newbie at react so I probably missed something basic.