1

When I use react-native-web , my App entry looks like the following

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

I wonder how I can pass props to the root Component in this case Advertiser in this case in a web environment.

4

1 回答 1

2

runApplication accepts another parameter in the second argument called initialProps alongwith rootTag

 AppRegistry.runApplication('SnsAdvertiser', {
     rootTag: document.getElementById('mainApp'),
     initialProps: {...}
 });
于 2019-01-21T12:53:57.657 回答