Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Could you clarify which of:

- page storage

- reducers

- replaying mutations

- acks

you're unclear on?



In that context, I don't understand the word reducer.


The reducer takes objects representing mutations and applies the appropriate changes to the state.

It's called a reducer because it operates like a reduce/fold operation, in that if you take a given state and an ordered list of mutations, you'll end up with a new state out the other side, much like 'let newState = list.reduce(reducer, initialState)' would in JS.

The reducer model is how Elm's state management works, and Redux's, and is what allow replaying of subsequent changes against a previous state to get to a current state (which enables, amongst other things, some the features of those systems' respective dev tools).

The article links to the (nearly trivial) reducer for the todo example, which is on github here: https://github.com/orbitinghail/sqlsync/blob/ba762ce2a10afbb...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: