wc-react-hook

1.0.1 • Public • Published

wc-react-hook

Simple wrapper to export your react components as web components to make them portable.

Install

yarn add wc-react-hook

Usage of the hook in your react

import { useWCHook } from 'wc-react-hook';
...
const Greeting = ({ name }) => <h1>Hello, {name}</h1>

Greeting.propTypes = {
  name: PropTypes.string.isRequired,
}

export default useWCHook(Greeting, 'web-greeting');

After this you can use <web-greeting name="thor"></web-greeting> as a web component.

Local Demo with parcel

yarn
yarn start

The local development server running at http://localhost:1234 that serves the basic demo is driven by index.html

Readme

Keywords

none

Package Sidebar

Install

npm i wc-react-hook

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

2.67 MB

Total Files

21

Last publish

Collaborators

  • scherler