Animation React.js scrollTop动画

Animation React.js scrollTop动画,animation,reactjs,scrolltop,Animation,Reactjs,Scrolltop,我基本上希望在React属性更改值时在React中设置scrollTop动画。我使用的“精简”组件如下所示: import React, { Component } from 'react'; class ScrollComponent extends Component { constructor(props) { super(props); this.scrollTo = this.props.scrollTo; } compon

我基本上希望在React属性更改值时在React中设置scrollTop动画。我使用的“精简”组件如下所示:

import React, { Component } from 'react';

class ScrollComponent extends Component {

    constructor(props) {
        super(props);
        this.scrollTo = this.props.scrollTo;
    }

    componentDidUpdate() {
        //Animate "container" to scroll to this.props.scrollTo in 1000ms
    }

    render() {
        return (
            <div ref="container" style={{height:'300px', width:'100%', overflowY:'scroll',position:'relative'}}>
                <div style={{height:'1000px'}}>
                </div>
            </div>
        )
    }
}
import React,{Component}来自'React';
类ScrollComponent扩展组件{
建造师(道具){
超级(道具);
this.scrollTo=this.props.scrollTo;
}
componentDidUpdate(){
//设置“容器”动画,以1000毫秒滚动到此.props.scrollTo
}
render(){
返回(
)
}
}
我猜这可以很容易地使用jQuery来完成,而使用原生JavaScript则有点棘手。使用React执行此操作的正确方法是什么

我知道ReactCSTranslationGroup和ReactTransitionGroup,如果有一种简单的方法可以使用这些插件,那就太好了,如果有其他方法,甚至更好


谢谢。

我不能对此发表评论。。但是你可以看看这个答案。。。