mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
bce0e5fec1
* Fixed some editor bugs * Some fixes * Update index.js
24 lines
448 B
JavaScript
24 lines
448 B
JavaScript
import React, {PureComponent, PropTypes} from 'react';
|
|
|
|
class Lazy extends PureComponent {
|
|
constructor (props) {
|
|
super(props);
|
|
this.state = {show: false};
|
|
}
|
|
|
|
componentDidMount () {
|
|
const delay = this.props.delay || 0;
|
|
setTimeout(() => this.setState({show: true}), delay);
|
|
}
|
|
|
|
render () {
|
|
return this.state.show ? this.props.children : null;
|
|
}
|
|
}
|
|
|
|
Lazy.propTypes = {
|
|
delay: PropTypes.number,
|
|
};
|
|
|
|
export default Lazy;
|