5

i just try to follow instruction to build an todo app from ionic x react documentation, But when i try to require I got this error (view the image) *Capture of result on the page* This is my code , sommeone see what i do by the wrong way ?

import { IonContent,
     IonHeader,
     IonPage,
     IonTitle,
     IonToolbar,
     IonList,
     IonItem,
     IonCheckbox,
     IonNote,
     IonLabel,
     IonBadge,
     IonFab,
     IonFabButton,
     IonIcon} from '@ionic/react';
import React from 'react';
import { add } from 'ionicons/icons';

const Home: React.FC<RouteComponentProps> = (props) => {
  return (
    <IonPage>
      <IonHeader>
        <IonToolbar>
          <IonTitle>Awema</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent className="ion-padding">
        <IonList>
          <IonItem>
            <IonCheckbox slot="start" />
            <IonLabel>
              <h1>Create Idea</h1>
              <IonNote>Run Idea by Brandy</IonNote>
            </IonLabel>
            <IonBadge color="success" slot="end">
              5 Days
            </IonBadge>
          </IonItem>
        </IonList>
        <IonFab vertical="bottom" horizontal="end" slot="fixed">
          <IonFabButton onClick={() => props.history.push('/new')}>
            <IonIcon icon={add} />
          </IonFabButton>
        </IonFab>
      </IonContent>
    </IonPage>
  );
};

export default Home;

2 Answers2

3

Your App cannot find the RouteComponentProps. You can import them to your app:

import { RouteComponentProps } from "react-router-dom";
0

You need to define RouteComponentProps

For example:

type RouteComponentProps = {
   className?: string,
   style?: React.CSSProperties
   name: string
}

export const Home: React.FC<RouteComponentProps> = // ...
Oron Bendavid
  • 1,485
  • 3
  • 18
  • 34