![](/img/trans.png)
[英]Typescript & react-navigation: Type Information on NavigationContainer ref?
[英]route (react-navigation) type in typescript
對於導航,我使用useNavigation from '@react-navigation/native';
我正在使用它在我的應用程序的兩個屏幕之間傳遞數據:
type UserDetailsProps = {
onDeleteContact: (id: number) => void;
route: any;
};
我不想在any
時候使用,但我不知道這里適合什么其他類型。
您可以使用這種類型:
type RouteParams = {
firstName?: string;
}
route?: RouteProp<Record<string, RouteParams>, ''>;
請注意,RouteProp 是@react-navigation/native
的命名導出
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.