reactjsionic-reactionic6

IonNav is not working with react 18 or ionic 6


here im using IonNav. import { IonNav } from "@ionic/react"; im getting blank screen with IonNav

return(
       <IonPage>
        <IonNav className="nav">
          <div>
            <h1>Please help</h1>
          </div>
        </IonNav>
      </IonPage>
     )


Solution

  • Move it to the root callback

     return (
        <IonNav
          root={() => (
            <div>
              <h1>Please asd</h1>
            </div>
          )}
        ></IonNav>
      );
    

    https://stackblitz.com/edit/angular-vytfp1-5pkrwm?file=src%2Fmain.tsx,src%2Findex.tsx