can't use in react
See original GitHub issueTell us about your environment win10
- Browser and Browser Version: chrome 73.0.3683.86
- After Effects Version:
What did you do? Please explain the steps you took before you encountered the problem.
- yarn add lottie-web
import React, { Component } from 'react';
import { connect } from 'dva';
import Lottie from 'lottie-web';
class Home extends Component {
constructor(props) {
super(props)
this.state = {
}
}
componentDidMount(){
Lottie.loadAnimation({
container: document.getElementById('svgcontainer'),
renderer: 'svg',
loop: true,
autoplay: true,
path: './svgjson/data.json',
})
}
render() {
return (
<div >
<div id='svgcontainer'></div>
</div>
)
}
}
export default Home;

What did you expect to happen?
show animation in home page
What actually happened? Please include as much relevant detail as possible.

Please provide a download link to the After Effects file that demonstrates the problem. link: https://pan.baidu.com/s/1P8yxcrqmSc1rQ-N_i8VW7g code: rgfy
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10
Top Results From Across the Web
I can't seem to be able to use hooks in react - Stack Overflow
Problem, can be using different version of react & react-dom dependencies. If you are using react-router-dom and have Routes like this
Read more >Invalid Hook Call Warning - React
There are three common reasons you might be seeing it: You might have mismatching versions of React and React DOM. You might be...
Read more >Why hooks are the best thing to happen to React
React hooks have so many benefits and functions they perform, but one of the big ones is to make the React lifecycle methods...
Read more >React Hook 'useState' cannot be called in class component
The error "React hook 'useState' cannot be called in a class component" occurs when we try to use the useState hook in a...
Read more >How To Fix The React Hook 'useState' cannot be called in ...
The Solution · Simply swap out useState with setState · Refactor your component into a function component if you specifically want to use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You are Chinese, I answer in Chinese:
@weiesky Not only Chinese wants to read the answer.