Last active
November 8, 2019 05:15
-
-
Save Sawtaytoes/d663c1e253f53bb5d7e9529588887281 to your computer and use it in GitHub Desktop.
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
<script> | |
import { createStore } from './fakeRedux.js' | |
let count = 0 | |
const stateModifiers = { | |
DECREMENT: () => { | |
count -= 1 | |
}, | |
INCREMENT: () => { | |
count += 1 | |
}, | |
} | |
const store = ( | |
createStore( | |
stateModifiers | |
) | |
) | |
</script> | |
<h1>Count: {count}</h1> | |
<button | |
on:click={() => { | |
store.dispatch({ type: 'DECREMENT' }) | |
}} | |
> | |
+ | |
</button> | |
<button | |
on:click={() => { | |
store.dispatch({ type: 'INCREMENT' }) | |
}} | |
> | |
- | |
</button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment