react-window-portal
v0.0.0
Published
React portal to another window
Downloads
5
Readme
React Window Portal
React Portal to a new window.
Inspired by Using a React 16 Portal to do something cool.
Example
import { WindowPortal } from "react-window-portal";
export class MyComponent extends React.PureComponent<{}, { isOpen: boolean }> {
public state = {
isOpen: false,
};
public render() {
return (
<div>
<button onClick={() => this.setState({ isOpen: true })}>open window</button>
{this.state.isOpen && (
<WindowPortal width={500} height={500}>
<button onClick={() => this.setState({ isOpen: false })}>close window</button>
</WindowPortal>
)}
</div>
);
}
}
Developing
git clone https://github.com/mscolnick/react-window-portal.git
yarn
NPM scripts
yarn test
: Run test suiteyarn start
: Runyarn run build
in watch modeyarn test:watch
: Run test suite in interactive watch modeyarn test:prod
: Run linting and generate coverageyarn build
: Generate bundles and typings, create docsyarn lint
: Lints codeyarn commit
: Commit using conventional commit style (husky will tell you to use it if you haven't :wink:)