couzic / lenrix

Type-safe, reactive, focusable redux store wrapper
MIT License
24 stars 1 forks source link

.updates(): allow a handler to return null or false to prevent a state update #55

Open couzic opened 5 years ago

couzic commented 5 years ago

Currently, one can return (state) => state

      searchBeerName: name => name.length > 0
          ? _.focusPath('loading').setValue(true)
          : state => state,

Returning null would look like:

      searchBeerName: name => name.length > 0
          ? _.focusPath('loading').setValue(true)
          : null,

Returning false would look like:

      searchBeerName: name => name.length > 0 && _.focusPath('loading').setValue(true)