|
|
|
|
|
by duncanawoods
3421 days ago
|
|
> but the value of JSX is the ability to easily nest elements There is nothing there that "makes JSX so powerful", its just hiding function calls and varargs. Its only xml-ish syntax. You are welcome to prefer it but its not adding anything functional beyond that. const Dashboard = (props) => {
const {user} = props;
let link;
if (user) {
link =
DOM.a({href: "..."},
Components.Avatar(user),
DOM.span(user.name));
}
return
DOM.div(link, ...some other content);
};
|
|
It's okay if you prefer to write code using the direct function calls, but I'm not sure most people would agree with you. I've built a product using direct calls (in CoffeeScript) and using JSX, and JSX was far easier to work with and less error-prone. YMMV.