I'm using my components as below and I want to check if one of inner components is returning anything or not to make style decisions based on that.
<Grid xs={12} md={ Bar() ? 8 : 12 }>
<Foo />
</Grid>
<Grid xs={12} md={4}>
<Bar />
</Grid>
Usually state elements can be introduced and set based on the same condition that you render the child (DashboardLongTermSuggestedPackages in this case). So that you can use the state element everywhere (isVisible) and render the remaining UI logic. ex : create [isVisible, setIsVisible] in parent, then pass and setIsVisible inside the child. So the Parent is aware of the current state.
Also, one more way, if you want to know if there is a child for a parent you can use props.children to verify.
<Parent> <Child/> </Parent>
then inside Parent, you can use props.children conditionally.
<div> <span>Hello</span> <span> <Bye /> </span> </div>
:emptyCSS selector, so you can hide that element.