如何在 ReactNaive 中将数据从一个场景传递到另一个场景 [英] How to pass data From one Scene to another in ReactNaive
问题描述
我的问题我有两个场景 OnceScene
和 TwoScene
我想从 OnceScene
导航到 TwoScene
并在同时我想从第一个和第二个传递一些数组,为此我编写了以下代码
this.props.navigator.push({id: "产品详细信息",
<块引用>
passProps: {arr: arr[rowID]}
});
你可以看到我在 passProps
中传递数组,但是我如何在 TwoScene
中访问该数组它看起来很简单,但由于我是新手,我没有太多想法.
我找到了我遗漏的东西,忘了声明
return (
导航器={导航器}
<块引用>{...route.passProps} route={route}
/>)
在我的返回组件上.这就是我获得 undefined
值的原因.
My Question i have two Scene OnceScene
and TwoScene
I want to Navigate from OnceScene
to TwoScene
and at the same time i want to pass some array from 1st the 2nd so for that i have written the below code
this.props.navigator.push({
id: "productdetails",
passProps: {arr: arr[rowID]}
});
you can see i am passing the array in passProps
but how can i acess that array in TwoScene
Its seems simple but since i am new i dont have much idea.
I found what i was missing ,forgot to declare
return (<ProductDetails title="ProductDetails"
navigator={navigator}
{...route.passProps} route={route}
/>)
on my return component. This is the reason i was getting undefined
value.
这篇关于如何在 ReactNaive 中将数据从一个场景传递到另一个场景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!