Storage Container
This is an alternative to redux and should work with react and inferno in particular but there is no reason it couldn't work with other things. It combines multiple kinds of storage so you don't have to
Usage
const storageContainer = // in-memory usage storageContainername_0storageContainername_0storageContainername_0storageContainername_0storageContainername_0 storageContainerstorageContainerstorageContainerstorageContainerstorageContainer // local storage storageContainername_0localstorageContainername_0localstorageContainerstorageContainer // history storageContainerstorageContainername_0storageContainername_0subnamestorageContainerlocation
With React (or similarly with Inferno)
going to make a stopwatch which starts the time, you can stop it, restart it and it saves your time to local storage so when you refresh the page it will be there, it also changes the time using the route so /hh-mm-ss will give hours minutes and seconds where as /hh-mm will only give hours and minutes etc.
const Ticker = { return <div> <h2>Ticker</h2> <button onClick=start disabled=startDisabled>Start</button> <button onClick=stop disabled=stopDisabled>Stop</button> <button onClick=restart disabled=restartDisabled>Restart</button> </div>}
const Format = { return <div> <h2>Format</h2> <input type="checkbox" checked=hoursChecked onChange=toggleHours /> <label>Hours</label> <input type="checkbox" checked=minutesChecked onChange=toggleMinutes /> <label>Minutes</label> <input type="checkbox" checked=secondsChecked onChange=toggleSeconds /> <label>Seconds</label> </div>}
const Time = { return <div> <h2>Time</h2> <span>value</span> </div>}
const tickerActions = { const interval = storageContainerticker } { storageContainerticker } { storageContainerticker storageContainertime storageContainertickerstart }
const actions = ticker: tickerActions
const reducers =
const StopWatch extends React.Component constructorprops superprops thisstorageContainer = } { return <div> <Ticker ...thisstorageContainerticker > <Format ...thisstorageContainerformat> <Time ...thisstorageContainertime > </div> }})