Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Last active November 8, 2019 05:15
Show Gist options
  • Save Sawtaytoes/d663c1e253f53bb5d7e9529588887281 to your computer and use it in GitHub Desktop.
Save Sawtaytoes/d663c1e253f53bb5d7e9529588887281 to your computer and use it in GitHub Desktop.
<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