This project is compatible with any project that can insert JavaScript into the DOM.
target: document.querySelector('#Counter')
.props
object and add it to your Counter objectvar counter = new Component.Counter();
and pass the final object containing both the target property and the props
object as parameters to new Component.Counter();
.var counter = new Component.Counter({
target: document.querySelector('#Counter'),
props: {
label: "Text from server side"
}
})
Modifications may be necessary to enable hot reloading with npm run dev
. These changes can be made in vite.config.ts
.
Feel free to add other examples in different languages and more complex use cases, and remember to add a star to this project if you find it useful.