Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-frame-component

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-frame-component

React component to wrap your application or component in an iFrame for encapsulation purposes

  • 5.2.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
157K
decreased by-37.57%
Maintainers
1
Weekly downloads
 
Created

What is react-frame-component?

The react-frame-component package allows you to render React components within an iframe. This can be useful for isolating styles, scripts, or for embedding third-party content within your React application.

What are react-frame-component's main functionalities?

Basic Usage

This feature allows you to render a simple React component inside an iframe. The Frame component wraps its children and renders them within an iframe.

import Frame from 'react-frame-component';

function App() {
  return (
    <Frame>
      <div>Hello from inside the iframe!</div>
    </Frame>
  );
}

Custom Head Content

This feature allows you to add custom content to the head of the iframe, such as stylesheets or scripts. The FrameContextConsumer provides access to the iframe's document and window objects.

import Frame, { FrameContextConsumer } from 'react-frame-component';

function App() {
  return (
    <Frame head={<><link rel="stylesheet" href="styles.css" /></>}>
      <FrameContextConsumer>
        {({ document, window }) => (
          <div>Hello with custom head content!</div>
        )}
      </FrameContextConsumer>
    </Frame>
  );
}

Styling Isolation

This feature allows you to isolate styles within the iframe, preventing them from affecting the rest of your application. This is useful for embedding third-party content or for creating isolated style environments.

import Frame from 'react-frame-component';
import './App.css';

function App() {
  return (
    <Frame>
      <div className="isolated-style">This is styled in isolation!</div>
    </Frame>
  );
}

Other packages similar to react-frame-component

Keywords

FAQs

Package last updated on 30 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc