I didn't look deep into Marko yet, but in my opinion JSX is by far the best HTML template language there is. And it's not restricted to React. Most other template languages hits serious limitations really fast. I tried and hated (for non trivial things): Angular, Handlebars, Razor (dotnet) and Vue (which does support JSX optionally).
Marko – A declarative, HTML‑based language
111–120 of 189 posts
Re: Marko – A declarative, HTML‑based language
#112It looks interesting and in a past life I probably would have tried it out but do you know why I like React? Because it's just JavaScript. This ` ` and ` ` syntax is awful.
I mostly agree with you but React isn’t just JavaScript. JSX is not JavaScript. It’s just that we’re so used to it we don’t consider it notable any more. Worth keeping in mind when you’re looking at a brand new framework.
var ListComponent = () => {
let count = 0, selected = null
return {
view: ({attrs: {items}}) =>
m("div", [
m("p", "Clicked: " + count + " times"),
m("ul", items.map(item =>
m("li", {
onclick: () => { count++; selected = item },
style: {cursor: "pointer", color: item === selected ? "blue" : "black"}
}, item)
)),
selected && m("p", "Selected: " + selected)
])
}
}Re: Marko – A declarative, HTML‑based language
#113It looks interesting and in a past life I probably would have tried it out but do you know why I like React? Because it's just JavaScript. This ` ` and ` ` syntax is awful.
Re: Marko – A declarative, HTML‑based language
#114Please chill w making new languages and frameworks that re-solve solved problems. The internet is working fine as it is.
Warmest regards, Matt
Re: Marko – A declarative, HTML‑based language
#115Dear front end devs Please chill w making new languages and frameworks that re-solve solved problems. The internet is working fine as it is. Warmest regards, Matt
Marko was created over a decade ago at Ebay.
One of its core dependencies is morphdom, which has been used successfully by a slew of frontend view libraries like Marko, including Phoenix LiveView.
Please chill. In general.
Use cases are not all equivalent.
Ignorance is boring.
Re: Marko – A declarative, HTML‑based language
#116It looks interesting and in a past life I probably would have tried it out but do you know why I like React? Because it's just JavaScript. This ` ` and ` ` syntax is awful.
Re: Marko – A declarative, HTML‑based language
#117Earlier quoted context omitted.
I mostly agree with you but React isn’t just JavaScript. JSX is not JavaScript. It’s just that we’re so used to it we don’t consider it notable any more. Worth keeping in mind when you’re looking at a brand new framework.
Speaking of writing javascript instead of JSX, I'm a big fan of the hyperscript approach: var ListComponent = () => { let count = 0, selected = null return { view: ({attrs: {items}}) => m("div", [ m("p", "Clicked: " + count + " times"), m("ul", items.map(item => m("li", { onclick: () => { count++; selected = item }, style: {cursor: "pointer", color: item === selected ? "blue" : "black"} }, item) )), selected && m("p"…
Re: Marko – A declarative, HTML‑based language
#118Earlier quoted context omitted.
Could you please try to be a bit more substantive with your comments? E.g., Why do you think JSX is the best? What limitations did you hit with those other template languages?
Most template languages can't do something like that: // data const numbered = true // or false const strings = ["a", "b", "c"] // render const items = strings.map(i => Item {i} ) if (numbered) return ( {items} ) else return ( {items} )
Re: Marko – A declarative, HTML‑based language
#119Maybe just me but I actually think building web apps is already fun. I’ve got a hot reloading instant dev environment, I can publish to users in an instant… it’s great! Looking at the Marko examples I feel the same way I do whenever similar stuff gets showcased: it’s trying to focus too hard on brevity and/or cutesiness and doesn’t seem like it would scale well to a full, complex web app. But maybe it’s not supposed…
Re: Marko – A declarative, HTML‑based language
#120Scheme is capable to represent HTML JS and CSS all in 1 language.