5

I run command ionic generate pages/login but me return this error

Since you're using the React project type, this command won't work. The Ionic CLI doesn't know how to generate framework components for React

Progman
  • 16,827
  • 6
  • 33
  • 48
Mike Otharan
  • 861
  • 1
  • 14
  • 31

1 Answers1

10

You'll have to make a new file in e.g src/pages/ (e.g. with the name xy.tsx) with the following contents:

import React from "react";
import {IonPage} from "@ionic/react";
const PageXY: React.FC = () => {
    return (
        <IonPage>
            ...
        </IonPage>
    );
};

export default PageXY;

and in your App.tsx aka Router you have to import it with import PageXY from "./pages/xy"; and hook it up to the Router like so: <Route path="/xy" component={PageXY} exact />

Hope this still helps someone

Mark
  • 485
  • 7
  • 14