Skip to content

Instantly share code, notes, and snippets.

@a7ul
Last active January 27, 2019 23:18
Show Gist options
  • Save a7ul/c0ca14e9092532cc99a3f9f77ca5ec71 to your computer and use it in GitHub Desktop.
Save a7ul/c0ca14e9092532cc99a3f9f77ca5ec71 to your computer and use it in GitHub Desktop.
react-webcomponentify-examples-my-button.js
import React from "react";
import { registerAsWebComponent } from "react-webcomponentify";
const MyComplexComponent = props => (
<div>
Kinda complex component 😂
<p>{props.text}</p>
<div>{props.children}</div>
</div>
);
registerAsWebComponent(MyComplexComponent, "my-complex-component");
/*
In html:
<my-complex-component text="component with children">
<p> I am a child element</p>
<div> I am another childish
<button>button</button>
</div>
</my-complex-component>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment