Skip to content

Instantly share code, notes, and snippets.

@sarinmsari
Last active December 21, 2023 13:39
Show Gist options
  • Save sarinmsari/0ff3ccccc1e8ca38fdab2898d8612027 to your computer and use it in GitHub Desktop.
Save sarinmsari/0ff3ccccc1e8ca38fdab2898d8612027 to your computer and use it in GitHub Desktop.
Add loading animation until iframe loads in react web app
class Rsvp extends React.Component {
constructor(props) {
super(props);
this.state = {
loading: true
};
}
hideSpinner = () => {
this.setState({
loading: false
});
};
render() {
return (
<div className="container rsvp-wrapper">
{this.state.loading ? (
<Spinner
className="loading text-center"
name="three-bounce"
color="white"
fadeIn="none"
/>
) : null}
<iframe
src="..."
width="100%"
height="700"
onLoad={this.hideSpinner}
frameBorder="0"
marginHeight="0"
marginWidth="0"
/>
</div>
);
}
}
@beyzagizil
Copy link

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment