动画不起作用-反应真棒

时间:2020-08-04 19:39:21

标签: reactjs animation react-animations

我想在我的打字稿项目中使用react-awesome-reveal,但是动画似乎不起作用。但是,当我使用反应揭示时,它可以工作。请就我所缺少的提供建议。

import React, { Component } from "react";
import { render } from "react-dom";
import Hello from "./Hello";
import { Fade } from "react-awesome-reveal";
import ReactRevealFade from "react-reveal/Fade";
import "./style.css";

class App extends Component {
  constructor() {
    super();
    this.state = {
      name: "React"
    };
  }

  render() {
    return (
      <div>
        <Fade>
          <Hello name={this.state.name} />
        </Fade>
        <ReactRevealFade left>
          <Hello name={this.state.name} />
        </ReactRevealFade>
        <p>Start editing to see some magic happen :)</p>
      </div>
    );
  }
}

render(<App />, document.getElementById("root"));

Stackblitz代码:Link

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

可以通过将组件包装在div中进行修复。