Skip to content

Commit

Permalink
Fixes example in Web Components docs (#11039)
Browse files Browse the repository at this point in the history
* fixes docs on webcomponent

* Update web-components.md
  • Loading branch information
trueadm authored and gaearon committed Oct 4, 2017
1 parent 1ba7dfc commit e0b802f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/docs/web-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ function BrickFlipbox() {

## Using React in your Web Components

Similarly, you can call `ReactDOM.render()` from inside a web component:

```javascript
class XSearch {
class XSearch extends HTMLElement {
connectedCallback() {
const mountPoint = document.createElement('span');
this.attachShadow({ mode: 'open' }).appendChild(mountPoint);
Expand All @@ -54,3 +56,7 @@ class XSearch {
}
customElements.define('x-search', XSearch);
```

>Note:
>
>This code will **not** work if compiled with Babel [due to an intentional limitation in the specification](https://github.com/w3c/webcomponents/issues/587). It will only work if you use the `class` syntax directly in the browser without compiling the code first.

0 comments on commit e0b802f

Please sign in to comment.