jsindos
jsindos

Reputation: 539

how to pass props to react-native when using React native web server side rendering?

Similar to this question, my App entry looks like

AppRegistry.registerComponent('SnsAdvertiser', () => Advertiser)
const { element, getStyleElement } = AppRegistry.getApplication('App', { string: 'hello!' })

Instead of using runApplication, I am using getApplication which is

getApplication: (key: string, params: AppParams) => ({ element, getStyleElement })

A web-only method for server-side rendering to HTML and CSS. It returns an object containing the given application’s element and getStyleElement function to get styles once the element is rendered.

The second argument of getApplication is params, but when I pass this in and log my props in my component, I get an empty object.

I'm wondering how I can pass props in a server environment.

Upvotes: 1

Views: 416

Answers (1)

jsindos
jsindos

Reputation: 539

Reading this I realised I have to pass params like { initialProps: { string: 'hello!' } }).

Upvotes: 1

Related Questions