Skip to content

Instantly share code, notes, and snippets.

@jwerle
Created January 27, 2016 18:35
Show Gist options
  • Save jwerle/5261406441c44d483b79 to your computer and use it in GitHub Desktop.
Save jwerle/5261406441c44d483b79 to your computer and use it in GitHub Desktop.
'use strict'
import { UPDATE, createContainer } from 'stardux'
let domElement = document.createElement('div')
let template = '#{spinner}'
let initialState = {spin: false, spinner: ''}
let container = createContainer(domElement, initialState, reducer)
domElement.innerHTML = template
function reducer (state, action) {
switch (action.type) {
case UPDATE:
return state.spin ? { spinner: 'SPIN' } : { spinner: '' }
default
return {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment