我不明白为什么 componentDidMount 运行两次?
class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0,
};
console.log("constructor");
}
componentDidMount() {
console.log("componentDidMount");
}
render() {
console.log('render');
return (
<div>
<p> Тест </p>
</div>
);
}
}