Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70757

Ionic(v4) React Menu controller

$
0
0

@rodvind wrote:

Hi everyone,
I really need some help with this ion-controller things in React.
This is the issue:
I wanted to have a Menu (hamburger) which when I clicked on, open the Menu for me including pages I can navigate to.
I don’t know how should I use the open() on click event function in my IonButton components to be able to show my menu list. I tried a couple of ways but didn’t go anywhere.
Here is the code I wanted to use:

const Menu: React.FC = () => {
  
  return (
    <>
      <IonMenu side="start" menuId="first">
        <IonHeader>
          <IonToolbar color="primary">
            <IonTitle>Start Menu</IonTitle>
          </IonToolbar>
        </IonHeader>
        <IonContent>
          <IonList>
            <IonItem>Menu Item</IonItem>
            <IonItem>Menu Item</IonItem>
            <IonItem>Menu Item</IonItem>
            <IonItem>Menu Item</IonItem>
            <IonItem>Menu Item</IonItem>
          </IonList>
        </IonContent>
      </IonMenu>
      <IonHeader>
        <IonToolbar>
          <IonButtons slot="start"> 
            <IonMenuButton autoHide={false} onClick={() => DO Some magic with open() to open the IonMenu}></IonMenuButton>
          </IonButtons>
        </IonToolbar>
      </IonHeader>
      <IonRouterOutlet></IonRouterOutlet>
    </>
  )

Thanks for your help

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70757

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>