下面是从react-navigation
文档中摘录的代码片段,其中介绍了如何将数据传递到上一个屏幕。
React.useEffect(() => {
if (route.params?.post) {
// Post updated, do something with `route.params.post`
// For example, send the post to the server
console.log(route.params.post);
}
}, [route.params?.post]);
一切正常,但是出现以下错误。
Property 'post' does not exist on type 'object'.
如何清除此错误?