[RFC] Switch mapPropsOnScroll to withWindowScroll
The propMapper of mapPropsOnScroll() currently accept two args
(nextScroll, prevScroll): Object => {}
IMHO prevScroll might be not used in some cases, so we should let consumers to save it by themselves if they need it. It is easily to achieve by using recompose/mapProps or rx-recompose/mapPropsStream and is already implemented in React componentWillReceiveProps().
If mapPropsOnScroll only provides nextScroll, it would be no difference to compose(withWindowScroll, mapProps) where withWindowScroll simply append scroll to props.
In addition, withWindowScroll would be more consistent with other HOCs in react-dom-utils.
@evenchange4 what do you think?
Actually, not. I think we should refactor some of withXXXs to mapPropsOnXXXs.
To implement a withXXX, we have to be opinionated on two things:
- The name of the prop to append. For examples:
windowSize,DOMSizeormousePosition. - The events to listen to. For examples,
resize,mousemoveormouseleave.
To implement a mapPropsOnXXX, we can avoid them.