New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

cross-component

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-component

Write components once with JSX, use with React or Vue

1.2.1
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created

cross-component

Write components once with JSX, use with React or Vue.

import type { AnyCrossElement } from 'cross-component';

import { defineComponent } from 'cross-component';

type ButtonProps = {
  name?: string;
};

type ButtonSlots = {
  icon?: () => AnyCrossElement;
  default?: () => AnyCrossElement;
};

export const Button = defineComponent<ButtonProps, ButtonSlots>((props, slots) => {
  return (
    <button name={props.name}>
      {
        slots.icon ? (
          <span>
            {slots.icon()}
          </span>
        ) : null
      }
      {slots.default.?()}
    </button>
  );
});

FAQs

Package last updated on 30 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts