Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- componentWillReceiveProps(nextProps: ButtonProps) {
- const currentLoading = this.props.loading;
- const loading = nextProps.loading;
- if (currentLoading) {
- clearTimeout(this.delayTimeout);
- }
- if (typeof loading !== 'boolean' && loading && loading.delay) {
- this.delayTimeout = window.setTimeout(() => this.setState({ loading }), loading.delay);
- } else {
- this.setState({ loading });
- }
- }
Add Comment
Please, Sign In to add comment