Skip to content

Instantly share code, notes, and snippets.

@capaj
Last active June 22, 2016 12:40
Show Gist options
  • Save capaj/516d5f246ea1ba139f1e99ec980564ad to your computer and use it in GitHub Desktop.
Save capaj/516d5f246ea1ba139f1e99ec980564ad to your computer and use it in GitHub Desktop.
react stateful function component
import React from 'react'
import {observer} from 'mobx-react'
import {observable} from 'mobx'
const state = observable({
value: 0
})
const Comp = (props) => {
return <div onClick={() => state.value++}>click to increase counter value: {state.value}</div>
}
export default observer(Comp)
@skellock
Copy link

Lovely reduction. Great starting point. You can really see where to go from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment