Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Iframe React Component

License version downloads monthly downloads

Simple react component to embeded iframed page and give a callback when completed load content

Install

npm install react-simple-iframe
OR
yarn add react-simple-iframe

Usage

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Iframe from 'react-simple-iframe'

class App extends Component {
  state = {
    iframeLoaded: false
  }

  handleLoadedIframe = () => {
    this.setState({ iframeLoaded: true })
  }

  render() {
    const { iframeLoaded } = this.state
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h1 className="App-title">Welcome to React</h1>
        </header>
        <p className="App-intro">
          To get started, edit <code>src/App.js</code> and save to reload.
        </p>
        { !iframeLoaded && <p>LOADING....</p> }
        <Iframe
          src='https://www.google.com'
          frameBorder='0'
          onLoaded={this.handleLoadedIframe}
        />
      </div>
    );
  }
}

export default App;

Properties

You can pass all standard properties <iframe /> but this component provide additional properties:

onLoaded - function

License

MIT. Copyright Ihsan Satriawan, and other contributors.

About

ReactJS Simple Component for Iframe

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages