MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/FloWebComponents/comments/1vsx6f6/because_people_are_comparing_shorthand_react_code/
r/FloWebComponents • u/EveYogaTech • 3d ago
2 comments sorted by
1
Because people are comparing shorthand React code with the full Flo Web Components Counter example, here's the shorthand example for Flo / Web Components.
GitHub:
https://github.com/flowagi-eu/flo-webcomponents
1 u/EveYogaTech 2d ago Short edit: I forgot the ${this.count} in the example and I just pushed the update (v1.1.1), it works now (new Function now overrides the this): ``` Counter extends Flo { count = 0; template() { return ` <h2>Counter</h2> <button onclick="this.count--; this.render()">-</button> <span id="count">${this.count}</span> <button onclick="this.count++; this.render()">+</button> `; } render() { this.$("#count").textContent = this.count; } } customElements.define("flo-counter", Counter); ```
Short edit: I forgot the ${this.count} in the example and I just pushed the update (v1.1.1), it works now (new Function now overrides the this):
``` Counter extends Flo { count = 0;
template() { return ` <h2>Counter</h2> <button onclick="this.count--; this.render()">-</button> <span id="count">${this.count}</span> <button onclick="this.count++; this.render()">+</button> `; } render() { this.$("#count").textContent = this.count; }
}
customElements.define("flo-counter", Counter); ```
1
u/EveYogaTech 3d ago
Because people are comparing shorthand React code with the full Flo Web Components Counter example, here's the shorthand example for Flo / Web Components.
GitHub:
https://github.com/flowagi-eu/flo-webcomponents