Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { createElement } from 'react';
- import { compose } from 'ramda';
- import { lifecycle, withProps } from 'recompose';
- const enhance = compose(
- lifecycle({ componentDidMount() {
- this.refs.node.scrollIntoView({block: 'end', behavior: 'smooth'});
- } }),
- withProps({ ref: 'node' }),
- );
- const autoScroll = Component => ({ ref, ...props }) =>
- createElement('div', { ref }, createElement(Component, props));
- export default compose(enhance, autoScroll);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement