我已经从 npm 安装了animejs,并导入了所需的文件,但是在我的代码中添加动画(代码)时,它无法正常工作并显示错误。
这是我所做的一个小例子:
import React from 'react';
import anime from 'animejs';
const test =()=>{
const animation = anime({
targets: '.css-selector-demo .el',
translateX: 250
});
return(
<div>
{
animation
}
</div>
)
}
export default test;
这是我得到的错误:
Error: Objects are not valid as a React child (found: object with keys {update,
begin, loopBegin, changeBegin, change, changeComplete, loopComplete, complete, loop,
direction, autoplay, timelineOffset, id, children, animatables, animations,
duration, delay, endDelay, finished, reset, set, tick, seek, pause, play,
reverse, restart, passThrough, currentTime, progress, paused, began, loopBegan,
changeBegan, completed, changeCompleted, reversePlayback, reversed, remaining}).
If you meant to render a collection of children, use an array instead.