This demo shows how simple functions can be automatically converted into reactive web components. Just write a function with destructured parameters and defaults, and get a fully reactive custom element!
A simple math component that reactively updates when the num
attribute changes:
User profiles with multiple reactive properties including booleans:
Open dev tools and try:
function myTest({text = "hello", num = 42}) { return `<div>${text} - ${num}</div>` }
const elem = createElement(myTest)
elem.text = "world"
document.body.appendChild(elem)