Skip to content

Instantly share code, notes, and snippets.

@tlvenn
Forked from capaj/component.js
Created June 22, 2016 12:36
Show Gist options
  • Save tlvenn/9700229025f5294ddc1544e22301804b to your computer and use it in GitHub Desktop.
Save tlvenn/9700229025f5294ddc1544e22301804b 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment