atomicojs / atomico

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
https://atomicojs.dev
MIT License
1.16k stars 43 forks source link

Readme example is broken - simple web-components don't work #23

Closed dy closed 4 years ago

dy commented 4 years ago

Sandbox

import { h, customElement } from "atomico";

function MyCustomButton() {
  console.log("atomico");
  return (
    <host>
      <button>Atomico custom button</button>
    </host>
  );
}

let btnClass = customElement(MyCustomButton);

// atomico button - fails
customElements.define("custom-btn-atomico", btnClass);
let btnA = document.createElement("custom-btn-atomico");
document.body.appendChild(btnA);

This component is never triggered.

dy commented 4 years ago

Something's up with codesandbox. Using atomico as cdn dep seems to work fine.

UpperCod commented 4 years ago

Hi, Your code is fine, but the problem has to do with the configuration of the sandbox eg https://codesandbox.io/s/atomico-base-fnq8h

dy commented 4 years ago

What's the config? That seems to be the case for haunted as well.