Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created July 23, 2018 13:41
Show Gist options
  • Save azamsharp/412efc3797fc72c5d6e2870a68fe8000 to your computer and use it in GitHub Desktop.
Save azamsharp/412efc3797fc72c5d6e2870a68fe8000 to your computer and use it in GitHub Desktop.
const redux = require('redux')
const createStore = redux.createStore
const initialState = {
posts : []
}
const rootReducer = (state = initialState, action) => {
return state
}
const store = createStore(rootReducer)
// subscriptions
store.subscribe(() => {
console.log("Subscription Fired!")
})
store.dispatch({ type : "INCREMENT_COUNTER" })
console.log(store.getState())
store.dispatch({ type : "ADD_COUNTER", value : 10})
console.log(store.getState())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment