Creating a component in Marko.js is straightforward. Here is an example of a simple "Hello World" component:
// hello-world.marko
<template>
<div>
Hello, ${input.name}!
</div>
</template>
<script>
module.exports = class {
onCreate(input) {
this.state = { name: input.name || 'World' };
}
};
</script>
You can use this component in another Marko template like this:
<hello-world name="Marko" />