I have created an Ionic React app using Ionic 5 tab template.
I want to pass an object from App component to tab component.
Is there any way to do it ?
Tab1 and Tab2 are my tab components.
Note: I want this object to be used in both Tab components with two way data binding i.e. whenever that object is changed in one Tab component, it must be updated in second Tab component.I want to achieve it without using Redux or any third party library.
My App component is like below:
<IonApp>
<IonReactRouter>
<IonTabs>
<IonRouterOutlet>
<Route path="/tab1"
component=Tab1
exact={true} />
<Route path="/tab2"
component=Tab2
exact={true} />
<Route path="/" render={() => <Redirect to="/tab1" />} exact={true} />
</IonRouterOutlet>
<IonTabBar slot="bottom">
<IonTabButton tab={"Title1"} href={"/tab1"}>
<IonIcon icon={settings} />
<IonLabel>{"Title1"}</IonLabel>
</IonTabButton>
<IonTabButton tab={"Title2"} href={"/tab2"}>
<IonIcon icon={settings} />
<IonLabel>{"Title2"}</IonLabel>
</IonTabButton>
</IonTabBar>
</IonTabs>
</IonReactRouter>
</IonApp>