Live data from Hacker News

JSX is no longer my friend

medium.com

11–20 of 144 posts

Re: JSX is no longer my friend

#11
post #2

I very much like how the recommended Hyperscript looks, but the package was last updated last December, and it doesn't even list React 0.14 in the compatibility list: it stops at v0.13, which was released in May 2015. Half a year before the last update of Hyperscript. It's arguably a small package that you could just rewrite if things go wrong, but is it a smart idea to base any project on semi-abandoned code?

If you think you'll like it you should just try it. hyperscript is tiny and probably doesn't need any changes to support any conceivable React version. If bureaucratic checkboxes are important to you then do some testing and submit a PR. If there are issues related to React updates then they'll probably get fixed when they are reported.

Re: JSX is no longer my friend

#13
post #2

I very much like how the recommended Hyperscript looks, but the package was last updated last December, and it doesn't even list React 0.14 in the compatibility list: it stops at v0.13, which was released in May 2015. Half a year before the last update of Hyperscript. It's arguably a small package that you could just rewrite if things go wrong, but is it a smart idea to base any project on semi-abandoned code?

That's what I don't like about a lot of bleeding-edge web development. You end up depending on a half-dozen abandoned pet projects. Somebody had an itch, scratched it, got bored. I swear half of the gulp eco-system is just that - half-abandoned, half-working little cute plugins that someone did because someone else's plugin, even though 99% identical, didn't do the one thing they wanted, so they wrote their own and t…

It almost feels that way about a lot of projects, even the ones sponsored by companies from Google down to the small fish.

Re: JSX is no longer my friend

#14

JSX always looked like an abomination to me. Don't know a single person who uses it

I assure you, plenty do. Including myself. I had a very negative reaction when I first read about it (much like the article author) after 5 minutes it started to make a lot of sense to me.

Re: JSX is no longer my friend

#15
post #2

I very much like how the recommended Hyperscript looks, but the package was last updated last December, and it doesn't even list React 0.14 in the compatibility list: it stops at v0.13, which was released in May 2015. Half a year before the last update of Hyperscript. It's arguably a small package that you could just rewrite if things go wrong, but is it a smart idea to base any project on semi-abandoned code?

That's what I don't like about a lot of bleeding-edge web development. You end up depending on a half-dozen abandoned pet projects. Somebody had an itch, scratched it, got bored. I swear half of the gulp eco-system is just that - half-abandoned, half-working little cute plugins that someone did because someone else's plugin, even though 99% identical, didn't do the one thing they wanted, so they wrote their own and t…

If a major framework hasn't had commits for a month that might indicate something. If it's just some random module that's small and has no major open issues, then that policy is unreasonable. Does your team regularly audit the commit streams of already-in-use dependencies so you can rip them out when the maintainers take a break?

Re: JSX is no longer my friend

#16
post #9

This article includes a tweet which demonstrates a very contrived example of a for loop using JSX. If you're ever writing code like this, please reevaluate your career in software development. As an aside, we recently moved from Nunjucks templates to React / JSX at work and the frontend team couldn't be more pleased. Components reflect improvements made to them across the board and provide a happy medium between desi…

"If you're ever writing code like this, please reevaluate your career in software development." That's a pretty nasty comment to make about anyone in this industry over a simple for loop.

Well, it is just plain wrong. Even if you wanted to do a for loop in JSX you'd do

    
        {for (var x=0;x
        }}
    
Not a templated component like that. That said, I have created repeater components and the like before, largely because JSX is so friendly that more design-minded people can use it very easily.

EDIT: turns out that doesn't actually work, ha. I've never written JSX that way.

    
        {[0,1,2,3].map((i) => {
            
        }}
    
on the other hand...

Re: JSX is no longer my friend

#17
post #12

Finally, somebody said it. I thought we abandoned that garbage when we left PHP, and now all of a sudden everybody wants to start mixing markup and code again?

Hyperscript is the same thing as JSX when used with React; just a different syntax. Either way you are "mixing markup and code."

Re: JSX is no longer my friend

#18
This article's direction makes sense for the task of 'writing HTML in JS'. I find that JSX true power comes when you actually start building reusable components for the many pieces of your UI.

This becomes even better when using a TypeScript capable editor with TSX, creating classes for the components and taking advantage of full autocomplete and syntax checking from your editor. Your code ends up pretty readable, composable and error free.

Re: JSX is no longer my friend

#19
post #14

JSX always looked like an abomination to me. Don't know a single person who uses it

I assure you, plenty do. Including myself. I had a very negative reaction when I first read about it (much like the article author) after 5 minutes it started to make a lot of sense to me.

I know that many people use React and JSX. anecdotally, I don't know any of them personally

Re: JSX is no longer my friend

#20
post #16

Earlier quoted context omitted.

"If you're ever writing code like this, please reevaluate your career in software development." That's a pretty nasty comment to make about anyone in this industry over a simple for loop.

Well, it is just plain wrong. Even if you wanted to do a for loop in JSX you'd do {for (var x=0;x }} Not a templated component like that. That said, I have created repeater components and the like before, largely because JSX is so friendly that more design-minded people can use it very easily. EDIT: turns out that doesn't actually work, ha. I've never written JSX that way. {[0,1,2,3].map((i) => { }} on the other hand…

You just proved the author's point. The JSX you provided is invalid, since you can't pass `for` as a function argument (see his equivalent bit about `if`).
Post reply on HN