import React from 'react'; class NotFound extends React.Component{ state ={ count:5 }; componentDidMount(){ this.timer = setInterval(()=>{ let count = this.state.count; this.setState({ count:count-1 }); if(count===1){ this.props.history.push('/home') } },1000); } componentWillUnmount(){ clearInterval(this.timer); } render(){ return (

404页面没有找到 {this.state.count} s

) } } export default NotFound;