How to receive the store passed by the mobx-react Provider?

0

This is my index.js:

import React from 'react';
import { Provider } from 'mobx-react';
import RootStore from './stores/RootStore';

ReactDOM.render( <Provider rootStore={ new RootStore() }><App/></Provider>, document.getElementById( 'root' ) );

This is my component:

import React, { Component } from 'react';
import { observer } from 'mobx-react';

class Painel extends Component {

  render() {
    return (
       <div style={ styles.container }>
         olá mundo!
       </div>
    )
  }
}

const styles = {
  container: {},
};

export default observer( Painel );

How do I get rootStore in my component Painel ?

    
asked by anonymous 03.11.2018 / 02:51

0 answers