scroll div on mouse move functional component code example

Example 1: react scrolling a div by dragging the mouse?

import React from 'react';import classNames from 'classnames';import PropTypes from 'prop-types';export class Timeline extends React.PureComponent {    render() {    const {      classes,      data,    } = this.props;    return (      <div ref={this.ref}>        <Timeline          data={data}        />      </div>    );  }}Timeline.propTypes = {  data: PropTypes.array,};export default Timeline;

Example 2: on click move item top react

<ul>
  <li>one</li>
  <li>two</li>
  <li>three</li>
</ul>