• Robert Knight's avatar
    Make thread building more idiomatic by using memoization (#3436) · 47d6c81e
    Robert Knight authored
    The idiomatic way to create derived data structures from data in the
    Redux state store is to do:
    
      derivedData = transform(select(store.getState()))
    
    Where the `select` function extracts the relevant fields from the state
    and the `transform` function then computes the derived data. Both
    `select` and `transform` can be trivially memoized to avoid unnecessary
    recalculations.
    
    This simplifies `root-thread` by avoiding inheritance from EventEmitter
    and in future will make it easier to avoid rebuilding the thread if none
    of the relevant application state has changed.
    47d6c81e
stream-controller.coffee 2 KB