How to pass props to components in ionic react

I recently started using ionic react,Im trying to pass props from one of my components to the other but im getting an errorerror
This is how im trying to pass the data

const onSubmit = (data:any) =>{
    return(
      <ScanNew formdata={data}/>
      );
  }

and then the component receiving the prop is below

const ScanNew: React.FC = ({formdata}) => {
console.log(formdata);
}

You are missing the TypeScript interface for your ScanNew component.

interface ScanNewProps {
  formData: any;
}

const ScanNew: React.FC<ScanNewProps> = ({ formData }) => {
  ...
}
1 Like