react-window-portal
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

React Window Portal

styled with prettier Greenkeeper badge Travis Coveralls Dev Dependencies

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 suite
  • yarn start: Run yarn run build in watch mode
  • yarn test:watch: Run test suite in interactive watch mode
  • yarn test:prod: Run linting and generate coverage
  • yarn build: Generate bundles and typings, create docs
  • yarn lint: Lints code
  • yarn commit: Commit using conventional commit style (husky will tell you to use it if you haven't 😉)

Readme

Keywords

Package Sidebar

Install

npm i react-window-portal

Weekly Downloads

0

Version

0.0.0

License

MIT

Unpacked Size

5.62 MB

Total Files

31

Last publish

Collaborators

  • mscolnick