I have a component that computes derived data from a store, but based on a variable argument. Can I use reselect for this?
For example I would like to move the following method to a selector. It merges the options and current values from a filter store based on the group argument:
getOptionsWithValues (group) {
const { options, values } = this.props.filter
const opts = options.filter(opt => opt.group === group)
return opts.map(opt => ({ ...opt, value: values.get(opt.id) }))
}
I feel like I should move this computation outside of the component. In a traditional Flux implementation I would create this method as a getter on the store but I don't know how to approach this with Redux.
I have a component that computes derived data from a store, but based on a variable argument. Can I use reselect for this?
For example I would like to move the following method to a selector. It merges the options and current values from a filter store based on the group argument:
I feel like I should move this computation outside of the component. In a traditional Flux implementation I would create this method as a getter on the store but I don't know how to approach this with Redux.