Skip to content

Instantly share code, notes, and snippets.

@GRardB
Created November 17, 2016 15:48
Show Gist options
  • Save GRardB/15c3a0d715a0e031481ab7eb089532b1 to your computer and use it in GitHub Desktop.
Save GRardB/15c3a0d715a0e031481ab7eb089532b1 to your computer and use it in GitHub Desktop.
// entry point
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { asMap, observable, useStrict } from 'mobx';
import { Provider } from 'mobx-react';
import { App } from './components/App';
useStrict(true);
const store = observable(asMap({}));
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('app')
);
// App.tsx
import * as React from 'react';
import { action, observable } from 'mobx';
import { inject, observer } from 'mobx-react';
import DevTools from 'mobx-react-devtools';
@inject('store') // i think this is correct?
@observer
export class App extends React.Component<??????, {}> {
render() {
return (
<div>
<h1>
App
</h1>
<DevTools />
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment