wompo
v1.3.1
Published
Wompo is a performant React-like JS library to create Web-Components that are re-usable, shareable, and beginner-friendly.
Downloads
427
Readme
Fast, React-like, Web-Components.
Documentation
Check the full documentation for Wompo at wompo.dev.
Quick Example: Counter
Creating a custom Counter component is very easy with Wompo, and works exactly like React!
import { defineWompo, html } from 'wompo';
export default function CounterComponent({ styles: s }) {
const [count, setCount] = useState(0);
const inc = () => setCount(count + 1);
return html`<button class=${s.button} @click=${inc}>
Current value: ${count}
</button>`;
}
CounterComponent.css = `
.button {
border-radius: 10px;
background-color: #573ef6;
color: #fff;
padding: 10px 20px;
border: none;
}
`
defineWompo(CounterComponent);
Then, you can simply render it in you HTML:
<counter-component></counter-component>
<!-- Will render: <button>Current value: 0!</button> -->
JSX
Wompo supports JSX. If you use it with Typescript, write this in your tsconfig.json
file:
"jsx": "react-jsx",
"jsxImportSource": "wompo",