Closed
Description
Hi all,
In react-redux new @connect API we don't have access to the (parent) props, which resembles Reselect's API.
To further filter state with props as parameters@connect allows to take control over the merging of props in it's third parameter 'mergeProps'. https://github.com/gaearon/react-redux#arguments and also see this PR from @jhollingworth: reduxjs/react-redux#36
Is the mergeProps function also a good place to make use of the composing/memoizing properties of Reselect?
As (pseudo) example:
export const dataSelectorFactory = (path) => {
return immutableCreateSelector(
[state => state],
data => {
return { value: data.getIn(path) };
}
);
};
@connect(
state => state.data,
null,
(mergeProps, dispatchProps, parentProps) => {
return { dataSelectorFactory(parentProps.path)(mergeProps), ...parentProps }
}
)
class User extends Component {
...
}
Or am I overthinking this and is there no use-case for Reselect here?
Thanks in advance!!
Metadata
Metadata
Assignees
Labels
No labels