Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

jankuca/react-context-iframe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Context iFrame

Creates a CSS frame component (react-css-iframe) which preserves the whole React context of its parent.

import ContextFrame from 'react-context-iframe'

class MyComponent extends React.Component {
  render() {
    return (
      <ContextFrame parent={this} src={...} [width={...}] [height={...}]>
        <MyChildComponent />
      </ContextFrame>
    )
  }
}

Notice the parent={this} prop. This is the component from which to clone the context.

The parent component does not need to specify a context type declaration (neither contextTypes or childContextTypes) for this to work. The whole unmasked context object is considered automatically. The child (MyChildComponent in the example) can take whatever it needs from the context as if there was no intermediary component in the tree.

Props other than parent are passed to the react-css-frame component.

Licence

MIT

About

react-css-iframe with context preservation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors