對React來說是新的,這讓我很難理解如何在React中動畫元素。有沒有簡單的方法來做到這一點,而不使用react-transition-group?假設我有這樣的代碼:動畫組件進入ReactJS中的DOM
class CategoriesList extends Component{
renderList(){
return this.props.categories.map((category) => {
return(
<div
key={category.title}
className="button">
{category.title}
</div>
)
})
}
render(){
return (
<div className= 'container'>
{this.renderList()}
</div>
)
}}
其中renderList()是一種方法,它根據道具呈現一些div的列表。如何在生成CategoriesList組件時將容器div淡入淡出?