I cant figure out mobx-react...
How do I pass props from a mobx observable to a mobx-react observer?
The code below doesn't works, but I feel like it should. Can someone tell me what is going wrong?
let mobxData = observable({information: "this is information"});
@observer class Information extends React.Component {
render() {
console.log(this.props.mobxData.information);
return (
<h1>class: {this.props.mobxData.information}</h1>
)
}
};
const StatelessInformation = observer(({mobxData}) => {
console.log(mobxData.information);
return <h1>stateless: {mobxData.information}</h1>
});
ReactDOM.render(
<div>
<Information/>
<StatelessInformation/>
</div>,
document.getElementById('app')
);