Skip to content

Instantly share code, notes, and snippets.

@kstulgys
Last active February 8, 2019 05:10
Show Gist options
  • Save kstulgys/757844713360b69e6182f1c24af21eca to your computer and use it in GitHub Desktop.
Save kstulgys/757844713360b69e6182f1c24af21eca to your computer and use it in GitHub Desktop.
import Store from "./store/index"
function App() {
const { state, setState } = Store.useStore()
const onInc = () =>
setState(state =>
state.count = state.count + 1
)
return (
<>
<p>{state.count}<p>
<button onClick={onInc}>Inc + 1</button>
</>
)
}
const rootElement = document.getElementById("root")
ReactDOM.render(
<Store.Provider>
<App />
</Store.Provider>,
rootElement
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment