Also accept a function as a prop transformer
Open
- Dominant language
- JavaScript
- Stars
- 45
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
This is just a suggestion, as it can lead to simpler code.
For example, with redux you can map the state to props via both simple objects or (for more complex use cases) functions.
Here's an example:
```
mapProps(props => {
const newProps = {}
if (someExternalService()) {
newProps.foo = 'bar'
}
return newProps
})(Component)
```
While I know you can achieve the same result using only objects, it's a nice to have.
BTW, nice work on this small handy HOC 👍
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.