19
loading...
This website collects cookies to deliver better user experience
described
in templates.embedded
would be a better word than described.
The information is embedded because it is not easily available to the framework. The framework needs to execute the template to get to the listener closure.import {addToCart} from './cart';
function MyBuyButton(props) {
const [cost] = useState(...);
return (
Price: {cost}
<button onclick={() => addToCart()}>
Add to cart
</button>
);
}
<button on:click=”MyComponent_click”>Click me!</button>
MyComponent_click.ts
export default function () {
alert('Clicked');
}
qwikloader.js
onto the page. It is less than 1KB, and takes less than 1ms to execute. Because it is so small, the best practice is to inline it into the HTML, which saves a server round trip.qwikloader.js
can register one global event handler and take advantage of bubbling to listen to all events at once. Fewer calls to addEventListener
=> faster time to interactive.