Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's true, sure. My response to that is in React you have JavaScript & JSX and there are clear boundaries. It's not mixed. I don't write

<for ...>

In JSX I write JavaScript that returns JSX:

{data.map(node => <Element {...node} />)}

^ ----- JS ----^ ^ ------ JSX -------^

or

const elements = data.map(node => <Element {...node} />) ... <div>{elements}</div>

Really the most obscure syntax there is the splatting but it makes sense to you when you realize that JSX is just syntactic sugar for JS:

data.map(node => React.createElement(Element, { ...node }))



I’ve never been a fan of JSX. I tried years ago and wasn’t super into it, and then Vue after that and found the syntax a lot easier on the mental model.


There are of course libraries that use JSX and have '<For>' components




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: