使用React Native Web时如何将道具传递给react-native?

时间:2018-12-18 09:24:30

标签: react-native react-native-web

当我使用react-native-web时,我的App条目如下所示

 AppRegistry.registerComponent('SnsAdvertiser', () => Advertiser)                                                                                                                                                                            
 AppRegistry.runApplication('SnsAdvertiser', { rootTag: document.getElementById('mainApp') });

我想知道如何在Web环境中将props传递给根组件Advertiser

1 个答案:

答案 0 :(得分:0)

runApplicationinitialProps一起在第二个参数rootTag中接受另一个参数

 AppRegistry.runApplication('SnsAdvertiser', {
     rootTag: document.getElementById('mainApp'),
     initialProps: {...}
 });