5 ms·
I think you're getting a little too worked up. The point is this small extension to JS grammar lets you do templating with normal JS, instead of #for you can u
by hunterb123 5y ago
I think you're getting a little too worked up.
The point is this small extension to JS grammar lets you do templating with normal JS, instead of #for you can use .forEach, .map and other array methods.
You can use JS instead of replacing tokens in a template.
It's not a superset of JS, that's not accurate, it's an extension of the spec.
I hope the JSX spec is added to the standard sometime to stop this stupid debate.
Until you realize what JSX is you don't realize the full potential it has over templates.
- JimDabell 5y ago> The point is this small extension to JS grammar lets you… If that’s the point, why are you telling people it’s JavaScript? You can make that point just fine without starting arguments. Saying “This is an extension to JavaScript” is fine. Saying “This is JavaScript” starts arguments. What is your goal here? > I hope the JSX spec is added to the standard sometime to stop this stupid debate. But you are starting this stupid debate by telling people it’s JavaScript when it isn’t. If you are tired of people pointing this out when you call it JavaScript, why do you do it? There seems to be absolutely nothing to gain from that except “a stupid debate”. > Until you realize what JSX is I know what JSX is. I’ve written plenty of JSX. > you don't realize the full potential it has over templates. We are not talking about the value of JSX, merely whether it is JavaScript or not. JSX could cure cancer, but it still wouldn’t be JavaScript.
- hunterb123 5y ago> If that’s the point, why are you telling people it’s JavaScript? You can make that point just fine without starting arguments. First, I say it's JS because it is. Just as decorators are JS. By being an extension of JS it is JS. The two are mutually inclusive. Second, I didn't want to start an argument, I wanted to call out the very wrong blog post, how it referenced React not JSX, how the spec is an extension of JS, explain the limitations, etc. Until now it was more of a debate. Now it's a bit more of a semantics debate unfortunately. > But you are starting this stupid debate by telling people it’s JavaScript when it isn’t. If you are tired of people pointing this out when you call it JavaScript, why do you do it? There seems to be absolutely nothing to gain from that except “a stupid debate”. Actually if you go up the comment chain you'll see I didn't start this debate. If you're tired, just don't participate. > We are not talking about the value of JSX, merely whether it is JavaScript or not. JSX could cure cancer, but it still wouldn’t be JavaScript. Oh but we are, again if you go up the comment chain, it's being compared to Svelte's template system, that's how it got brought up, and that's usually why this topic gets brought up. You don't have to create a whole template system. You just use nested functions. To use pretty brackets it needs a small extension of the spec. You don't have to come up with a loop system, a conditional system, etc.
- JimDabell 5y ago> By being an extension of JS it is JS. The two are mutually inclusive. This is absurd. If JSX were JavaScript, JavaScript wouldn’t need to be extended to include JSX. The whole point of it being an extension is that JavaScript doesn’t include it, therefore JSX extends it. If JSX were JavaScript, then JavaScript wouldn’t need to be extended. The two are mutually exclusive. > > We are not talking about the value of JSX, merely whether it is JavaScript or not. JSX could cure cancer, but it still wouldn’t be JavaScript. > Oh but we are, again if you go up the comment chain In the context of “Is JSX JavaScript?”, the value of JSX is irrelevant. Whether JSX is useless, useful, or amazing makes zero difference to the question of whether JSX is JavaScript or not. You can still go around telling people JSX is great. It doesn’t have to be JavaScript for you to do that. People telling you that it isn’t JavaScript aren’t telling you that it’s worthless. They are just telling you that it isn’t JavaScript.
- hunterb123 5y agoAre decorators JS? Answer that question and I'll respond to the rest of your comment. We're talking in circles a bit so I'd like to drill that down first.
- JimDabell 5y agoDecorators are a stage two proposal. This means that they are not yet JavaScript, but are expected to be soon.
- hunterb123 5y agoThe point of all of this is it's a JS feature, not a system written on top of JS. A few syntax changes unlocks the rest of JS instead of having to reinvent the wheel, making your own loop and conditional systems. I don't see why the semantics of it not being included yet doesn't make it JS. When the feature isn't in all browsers and only Babel doesn't make it not JS, similar to how async functions were JS before being natively in JS engines. You're not being genuine when you say decorators aren't JS. No one looks at Angular 2 and says "whoa that's using some foreign language mixed with JS", they say it's using a JS experimental feature. I'll concede that it's not "JS" it's an "experimental JS feature", I'll use that in the future to avoid this pedantic debate.
- dmitriid 5y ago> The point is this small extension to JS grammar lets you do templating with normal JS, instead of #for you can use .forEach, .map and other array methods. But then React is much more than just "small extension". Hooks alone are less of a Javascript than any Svelte template syntax.
- hunterb123 5y agoWe're not talking about React we're talking about JSX. Svelte has a lot more going on than it's template language as well. We're only comparing the templating system to JSX.
- dmitriid 5y agoLet's compare to JSX then: https://news.ycombinator.com/item?id=29194287 https://news.ycombinator.com/item?id=29194287
- hunterb123 5y agoThat's still React. JSX is only turning brackets, tag names, and attributes into function calls and object properties. Special attributes, events, etc. are React specific and not related to JSX. Basically it's a clean way to represent nested function calls, that's it. It has nothing to do with React nor does it need React. <tag prop="value"/> gets turned into React.createElement('tag', {prop: "value"}) That's all. Period. The special props React introduces has nothing to do with JSX. Also you can customize JSX to change the functions it generates. (i.e. swapping out React.createElement)
- dmitriid 5y agohttps://news.ycombinator.com/item?id=29206956 https://news.ycombinator.com/item?id=29206956
- dragonwriter 5y agoThose are all features of React or the React JSX transform, not JSX. Other JSX transforms or frameworks using them may or may not share any or all of them. (JSX is not only used in React.)