【发布时间】:2022-09-30 18:53:48
【问题描述】:
我正在制作一个 Ionic React 项目,最近(可能是因为更新)我的所有 @ionic/react 元素在每次使用时都会返回错误。
我的代码:
//import { useParams } from \'react-router\';
import \'./css/Page.css\';
import Login from \'../components/Login\';
import { IonButtons, IonContent, IonHeader, IonMenuButton, IonPage, IonTitle, IonToolbar } from \'@ionic/react\'
const pageName = \"Login\"
const Page: React.FC = () => {
//const { name } = useParams<{ name: string; }>();
// PLS FIX IDK WHY IT\'S GIVING ERRORS (it\'s @ionic/react)
return (
<IonPage>
<IonHeader>
<IonToolbar>
<IonButtons slot=\"start\">
<IonMenuButton />
</IonButtons>
<IonTitle>{pageName}</IonTitle>
</IonToolbar>
</IonHeader>
<IonContent fullscreen>
<IonHeader collapse=\"condense\">
<IonToolbar>
<IonTitle size=\"large\">{pageName}</IonTitle>
</IonToolbar>
</IonHeader>
{Login()}
</IonContent>
</IonPage>
);
};
export default Page;
Type \'{}\' is not assignable to type \'Pick<React.HTMLAttributes<unknown>, \"id\" | \"hidden\" | \"dir\" | \"slot\" | \"title\" | \"color\" | \"translate\" | \"children\" | \"className\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | ... 240 more ... | \"onTransitionEndCapture\"> & IonicReactProps & RefAttributes<...>\'.
Type \'{}\' is missing the following properties from type \'Pick<React.HTMLAttributes<unknown>, \"id\" | \"hidden\" | \"dir\" | \"slot\" | \"title\" | \"color\" | \"translate\" | \"children\" | \"className\" | \"defaultChecked\" | \"defaultValue\" | \"suppressContentEditableWarning\" | ... 240 more ... | \"onTransitionEndCapture\">\': id, hidden, dir, slot, and 249 more.
在 package.json 中,@ionic/react 看起来像这样:
\"@ionic/react\": \"^6.2.9\"
请帮忙,我的项目中有 46 个错误
标签: reactjs react-native ionic-framework ionic-react