|
|
|
|
|
by SwiftyBug
15 days ago
|
|
I don“t get the design choice for Glimmer components: export default class CounterComponent extends Component {
<template>
<p>0</p>
<button type="button">+1</button>
<button type="button">-1</button>
</template>
}
This is obviously not valid JS. If they already had to create a DSL for components, why not embrace it fully and introduce a different keyword instead? export default component CounterComponent < Component {
<template>
<p>0</p>
<button type="button">+1</button>
<button type="button">-1</button>
</template>
}
JSX class components, even though not technically valid JS (render method returns HTML-like syntax), resemble a JS class much more as it requires methods to declare the template and handle component lifetime. |
|