0.2.0 • Published 1 year ago

@ridafkih/portalgun v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Installation

To install @ridafkih/portalgun, simply use your favourite Node.js package manager.

yarn add @ridafkih/portalgun
npm install @ridafkih/portalgun

Usage

// ...
import { PortalGunProvider, createPortal } from "@ridafkih/portalgun";

const MyPortal = createPortal("unique-key");

const MyComponent = () => {
  const [value, setValue] = useState<boolean>(true);
  const text = value ? "Yay, value is true!" : "Unfortunately, value is false.";

  return (
    {/** Anything that goes in here will render in all corresponding `MyPortal.Out` */}
    <MyPortal.In>
      <Text>{text}</Text>
    </MyPortal.In>
  );
};

export const MyApp = () => {
  return (
    <PortalGunProvider>
      {/** This contains is defined above, and contains our `MyPortal.In` */}
      <MyComponent />
      {/** Content of `MyPortal.In` will display here. */}
      <MyPortal.Out />
    </PortalGunProvider>
  );
};

Contribute

Feel free to contribute to the repository. Pull requests and issues with feature requests are super welcome!

0.2.0

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago