Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

react-stencil-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-stencil-wrapper

React Stencil Wrapper

latest
Source
npmnpm
Version
0.0.10
Version published
Maintainers
1
Created
Source

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>
    )
  }
}

FAQs

Package last updated on 02 Jun 2019

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