mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-24 05:02:24 +08:00
22 lines
424 B
JavaScript
22 lines
424 B
JavaScript
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
|
||
|
export default class DelayedRender extends React.Component {
|
||
|
static propTypes = {
|
||
|
children: PropTypes.node.isRequired,
|
||
|
};
|
||
|
state = {
|
||
|
show: false,
|
||
|
};
|
||
|
componentDidMount() {
|
||
|
setTimeout(() => {
|
||
|
this.setState({
|
||
|
show: true,
|
||
|
});
|
||
|
}, 1000);
|
||
|
}
|
||
|
render() {
|
||
|
return this.state.show ? this.props.children : <div />;
|
||
|
}
|
||
|
}
|