Skip to content

Instantly share code, notes, and snippets.

@MarcoWorms
Last active December 1, 2016 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcoWorms/49b330321e13f77d8a66f76866e71c9c to your computer and use it in GitHub Desktop.
Save MarcoWorms/49b330321e13f77d8a66f76866e71c9c to your computer and use it in GitHub Desktop.
function renderState (state) {
var html = '<p>' + state.something + '</p>'
document.getElementById('root').innerHTML = html
}
function createStore() {
var state = {
something: "olá mundo"
}
renderState(state)
return {
getState: function () {
return state
},
setState: function (newState) {
state = newState
renderState(state)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment