Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions static/usage/v9/tabs/select-method/react/main_tsx.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
```tsx
import React, { useRef } from 'react';
import React, { useContext } from 'react';
import {
IonButton,
IonContent,
IonIcon,
IonHeader,
IonTab,
IonTabs,
IonTabsContext,
IonTabBar,
IonTabButton,
IonTitle,
Expand All @@ -18,12 +19,13 @@ import { playCircle, radio, library, search } from 'ionicons/icons';

import './main.css';

function Example() {
const selectRadio = () => {
const tabs = document.querySelector('ion-tabs');
tabs?.select('radio');
};
function GoToRadioButton() {
const { selectTab } = useContext(IonTabsContext);

return <IonButton onClick={() => selectTab('radio')}>Go to Radio</IonButton>;
}

function Example() {
return (
<IonTabs>
<IonTab tab="home">
Expand All @@ -36,7 +38,7 @@ function Example() {
<IonContent>
<div className="example-content">
Listen now content
<IonButton onClick={selectRadio}>Go to Radio</IonButton>
<GoToRadioButton />
</div>
</IonContent>
</IonPage>
Expand Down
Loading