If I have to write bindings for this, how should we go about it
import {html, css, LitElement} from 'lit';
export class SimpleGreeting extends LitElement {
static styles = css`p { color: blue }`;
static properties = {
name: {type: String},
};
constructor() {
super();
this.name = 'Somebody';
}
render() {
return html`<p>Hello, ${this.name}!</p>`;
}
}
customElements.define('simple-greeting', SimpleGreeting);
To be clear, its not about consuming the component, but to write one.
1 Like
DZakh
January 22, 2022, 4:14pm
2
I’d wrap the class in a function factory and have written bindings for the function.
1 Like
ryyppy
January 25, 2022, 3:06pm
3
You can’t express those semantics in ReScript unfortunately.
1 Like
YKW
November 5, 2024, 12:02pm
4
Does rescript have better tools to express this now after v11.1?
tsnobip
November 5, 2024, 12:08pm
5
we now have tagged template functions in rescript v11.1.
But we still have no semantics around classes and I don’t think we have any plans for that. The best solution likely to follow DZakh’s advice, create a function factory in JS and write bindings to it.
2 Likes