Reputation: 315
im trying to integrate Mobx(I´m new to Mobx to be honest) to my existing react-native project and one big question I have is how should the indexfile look like?
mine is looking now like this:
import { AppRegistry } from 'react-native';
import App from './../App/App';
AppRegistry.registerComponent('AppName', () => App);
but some tutorials told me that it should look like this:
{a bunch of imports here...}
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
but i dont get the second one running.
so my question is how should the index.js look like?
Upvotes: 0
Views: 147
Reputation: 12018
The AppRegistry.registerComponent
accepts a function which returns a component, so it should work if you have that component render the Provider.
const Root = () => (
<Provider {...stores}>
<App />
</Provider>
)
AppRegistry.registerComponent('AppName', () => Root)
Upvotes: 2