How can I use the parent component in child compon...
# decompose
v
How can I use the parent component in child components? I have a HomeScreenComponent, and it has some child components using a Bottom Nav Bar I want to let these ChildComponents also access the parent component, like we have SharedViewModels
a
You can pass the parent component into a child component via constructor. But this generally is not recommended, because it introduces coupling between components. Depending on your needs, you can pass a callback to the child component and act in the parent, or you can pass a Flow/Observable to child and send events from the parent, etc.
v
Passing flow seems correct for my use case It is to send event that the bottom nav item for this component is reselected and so list should scroll list to top