@ignition-concept/react-forward-slot
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

React Forward Children Slot

Installation

# for npm
npm i @ignition-concept/react-forward-slot

# for yarn
yarn add @ignition-concept/react-forward-slot

# for pnpm
pnpm install @ignition-concept/react-forward-slot

Usage

import { Slot } from "@ignition-concept/react-forward-slot";

/**
 *
 * Note: `forwardAs` attributes just for type definition it doesn't affect you
 * component
 *
 **/

export function Expose({ children, ...props }) {
  return (
    <Slot
      forwardAs="button"
      onClick={function () {
        return console.log("hello world Expose");
      }}
    >
      <button {...props}>Hello World</button>
    </Slot>
  );
}

export function Exposed() {
  return (
    <Slot
      forwardAs={Expose}
      onClick={function () {
        return console.log("hello world Exposed");
      }}
    >
      <Expose>Hello World</Expose>
    </Slot>
  );
}

Note: internal usage only*

* use at your own risk

Readme

Keywords

Package Sidebar

Install

npm i @ignition-concept/react-forward-slot

Weekly Downloads

0

Version

0.1.0

License

ISC

Unpacked Size

7.93 kB

Total Files

8

Last publish

Collaborators

  • iterator-syntax