🚧 At this stage, this project is not unit-tested but works as expected. Use with caution. 🚧
Autoscroll a react component
npm install --save autoscroll-react
import React from 'react'
import Autoscroll from 'autoscroll-react'
class MyList extends React.Component {
render(){
const { items, ...props } = this.props
return (
<ul { ...props } >{ // You MUST pass down props
items.map(
item => <Item
key={ item.id }
{...item}
/>
)
}</ul>
)
}
}
export default Autoscroll(MyList)
Autoscroll(Component)
: returns the passed component without any additional markup.
It scrolls the root node rendered by the component to the bottom whenever it updates, but not if the user has scrolled up.