React-native + mobx how the Index.js should look like

PrinzAndreVonLandmann

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:

Index.js:

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:

Index.js:

 {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?

kingdaro

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)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How should BMP header look like?

How should look like a morphline for MapReduceIndexerTool?

How should an inline SVG look like

How should "baseSiteUrl" look like in SPSite?

How to trigger a state like setState with MobX, mobx-react-lite?

How to set array value in react native mobx?

How to use React Native ListView with MobX?

How to use MobX with decorators in React Native 0.57?

React native and MobX: How to create a global store?

How to Persist Mobx State Tree in React Native?

How should simple database should look like with two tables?

React how should be the like functionality

Scala on IntelliJ with Git: How should the .gitignore look like?

How time zone variable for Kubernetes should look like?

How the unit test for the void method should look like?

Converting JSON to a MySQL table, how should the table structure look like?

How request spec for 'sharing' function should look like?

How should properly formatted data for NER in BERT look like?

How should method of DDD Entity look like in a client app?

How should the parameters for axios look like according to the url example

What should the MBR look like?

Output should look like a quotation

How to make swing apps look like native apps of a platform

How to enable strict mode in mobx store, react-native

How to initialize MobX store with async data (AsyncStorage) in React Native

How to use mobx in react-native 0.56 (Babel 7) with Decorators

React native index.js and import react

MobX with React Native: store is undefined

React native and mobx: [getFunction] is not a function