ReactJS: setTimeout() not working?

前端 未结 10 2194

Having this code in mind:

var Component = React.createClass({

    getInitialState: function () {
        return {position: 0};    
    },

    componentDid         


        
10条回答
  •  星月不相逢
    2020-12-04 08:00

    You did syntax declaration error, use proper setTimeout declaration

    message:() => { 
      setTimeout(() => {this.setState({opened:false})},3000); 
      return 'Thanks for your time, have a nice day 

提交回复
热议问题