0.0.10 • Published 5 years ago

react-stencil-wrapper v0.0.10

Weekly downloads
10
License
MIT
Repository
github
Last release
5 years ago

React Stencil Wrapper

This module enables you to easily wrap Stencil components in React apps, taking full advantage of life cycle hooks so events are added and removed whenever a React component is mounted and unmounted.

Example usage where 'st-button' is a Stencil component:

import { StencilComponentWrapper } from './react-stencil-wrapper';

function App() {
  const [name, setName] = useState('');

  render() {
    return (
      <div>
        <input
          type="text"
          onChange={e => setName(e.target.value)}
          name="name"
          value={name}
        />
        <hr/>
        <StencilComponentWrapper
          name={name}
          clickEvent={(e) => { console.log(`function was called ${e}`}}
          eventListeners={{
              buttonClicked: (e) =>{ console.log(`event was triggered ${e.detail}`)}}
          }}
          componentDidMountCallback={el => {
              el.focus();
          }}
        >
          <st-button>Click Me</st-button>
        </StencilComponentWrapper>
      </div>
    )
  }
}
0.0.10

5 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago