Last active
June 22, 2016 12:40
-
-
Save capaj/516d5f246ea1ba139f1e99ec980564ad to your computer and use it in GitHub Desktop.
react stateful function component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lovely reduction. Great starting point. You can really see where to go from here.