Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 从React prop启动SVG动画_Reactjs_Typescript_Svg - Fatal编程技术网

Reactjs 从React prop启动SVG动画

Reactjs 从React prop启动SVG动画,reactjs,typescript,svg,Reactjs,Typescript,Svg,我想知道是否有一种方法可以从React中的道具开始动画 type ComponentProps= { startAnimation: boolean; } class Component extends React.PureComponent<ComponentProps> { ... render() { return <svg .. <animate begin={this.props.startAnimation

我想知道是否有一种方法可以从React中的道具开始动画

type ComponentProps= {
  startAnimation: boolean;
}
class Component extends React.PureComponent<ComponentProps>
{
  ...
  render()
  {
    return <svg
      ..
        <animate begin={this.props.startAnimation ? What goes here? : "indefinite"} />
    </svg>;
  }
}
type ComponentProps={
startAnimation:布尔值;
}
类组件扩展了React.PureComponent
{
...
render()
{
return可能是您正在寻找的,并且没有太多的转换

只需将
更改为
等,您就可以使用它们的动画、隐藏和变体道具来启动/停止不同的动画。framer