Skip to content

Instantly share code, notes, and snippets.

@bitttttten
Created December 2, 2016 22:51
Show Gist options
  • Save bitttttten/bcee0723c58a5d8984bf6b55502f521a to your computer and use it in GitHub Desktop.
Save bitttttten/bcee0723c58a5d8984bf6b55502f521a to your computer and use it in GitHub Desktop.
mobx app observer with authentication
const App = observer(({ store }) => {
const { authenticated } = store
if (!authenticated ) {
return <Login
doLogin={store.login}
postLogin={store.showHomepage}
/>
}
return <div className="app">
<div className="left">
<h2>{`hello ${store.currentUser}`}</h2>
<ContactList contacts={store.contacts} />
</div>
<div className="right">
{ renderCurrentView({ store }) }
</div>
</div>
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment