-
-
Save tlvenn/9700229025f5294ddc1544e22301804b to your computer and use it in GitHub Desktop.
react stateful function component
This file contains hidden or 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