Loader.js
958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React, {Component} from 'react';
class Loader extends Component{
/*componentDidMount(){
}*/
render(){
var history=this.props.history
if(typeof this.props.goTo!=='undefined' && typeof history !== 'undefined'){
setTimeout(function(){history.replace(this.props.goTo)}.bind(this),2000)
}
const className='ajax-loader-ct '+this.props.className
return(
<div className={className}>
<div className='ajax-loader-wrapper'>
<div className="loader_spinner"></div>
<h3>{this.props.heading}</h3>
<p>{this.props.subHeading}</p>
</div>
</div>
)
}
}
/*const Loader = () => (
<Route componentDidMount={() => {setTimeout(function(){history.push('/solution')},2000)}} render={({ history}) => (
<div>
sono un loader!
</div>
<button
type='button'
onClick={() => { history.push('/new-location') }}
>
Click Me!
</button>
)} />
)*/
export default Loader