4 ms·
> Why? JSX was one of the main reasons React became so popular. What would you have instead of JSX? JSX was also one of the main reasons why people opposed it
by antris 6y ago
> Why? JSX was one of the main reasons React became so popular. What would you have instead of JSX?
JSX was also one of the main reasons why people opposed it at first. We were taught to never mix HTML and JS and put markup in a separate file. Of course separate template files as a concept were bad in the first place, but it served as a red herring for those learning. It "felt wrong" to many people who wanted to "just write Javascript". React works perfectly fine without JSX. I mean the syntactic sugar is nice, but the VDOM implementation was the breakthrough innovation that made React popular. You can have JSX if you want, but at the time of release, most people hated a new compilation step just for a bit of syntax comfort.
> its original API of `React.createClass` was really no different from hundreds of similar APIs.
Yes, this is the API that I am talking about. There was never a need to combine state handling into the first virtual DOM engine. If there are hundreds of similar APIs, why create another one? Why not let the developer choose their own favourite Class implementation? Some people (such as myself) try to distance themselves from OOP as much as possible, so the class API was quite worthless.
- sfvisser 6y ago> We were taught to never mix HTML and JS and put markup in a separate file. Yeah, but we were all still doing it anyways. Maybe not for our web pages, but definitely for our apps. I don’t think that part of react has ever been very controversial to people who were already building large webapps to begin with.
- antris 6y agoYes I agree, React broke that mould and web apps are better for it. But it was controversial. The React team even got ridiculed early on: https://www.youtube.com/watch?v=x7cQ3mrcKaY#t=35s https://www.youtube.com/watch?v=x7cQ3mrcKaY#t=35s And the person who wrote that tweet wasn't alone. It's perhaps easy to forget how much opposition there was to React. Facebook was quite a bit further than many in the industry, and Pete Hunt from Facebook admits that "we weren't communicating what we were doing". It was a bit much to swallow for many at first, but in the end, the VDOM was such a powerful idea that React was destined to take off sooner or later.
- tshaddox 6y agoGetting ridiculed early on and then quickly becoming by far the most prominent and popular library in your category doesn’t sound so bad. It’s not something I would criticize React for.
- antris 6y agoI'm not criticizing the team. I definitely couldn't have done a better job myself. Hindsight is 20/20, I'm just observing and trying to dissect what it's like to learn React from scratch in... 2020.
- dmitriid 6y ago> JSX was also one of the main reasons why people opposed it at first. However, significantly more accepted it, and used it. > React works perfectly fine without JSX. I mean the syntactic sugar is nice, but the VDOM implementation was the breakthrough innovation that made React popular. There were several breakthrough innovations. The other one was unidirectional data flow. For some reason, you oppose it. > > its original API of `React.createClass` was really no different from hundreds of similar APIs. > Yes, this is the API that I am talking about. 1. This API is nowhere even close to "provide classes, the whole bells and whistles." 2. This API was very similar to nearly every other API that existed at the time > There was never a need to combine state handling into the first virtual DOM engine. Why? Why wasn't the need there? What value its absence would bring? You are complaining now that "Some people even throw Redux at the junior programmer at the same time". And Redux exists precisely because React doesn't provide a solution in this space. Now imagine if React only released the DOM diffing library. How many Reduxes there would be trying to fix the actual rendering of data? You would complain now that "Some people even throw <rendering> and Redux and novice programmers". The beauty and simplicity of React was that it very neatly solved the rendering and re-rendering of data in very few concepts that you could learn in under an hour. > If there are hundreds of similar APIs, why create another one? Because those different APIs work in the context of a different framework with completely different semantics > Why not let the developer choose their own favourite Class implementation? There were no classes. React was released before classes where even standardised in the language. There were non "favorite class implementations". All these APIs where doing an equivalent of `Object.extend`. But since they needed to do different things, they provided different APIs. Why is it so hard to understand? - Backbone has Backbone.Collection.extend({...}) - Knockout has ko.components.register('...', {...}) - Ember had DS.Model.extend({...}) - React had React.createClass({...}) They are all similar APIs in the sense that they extend some objects with custom definitions for specific parts of the API. APIs that are specific to the frameworks that define them. What "favorite class implementation" are you even talking about? > Some people (such as myself) try to distance themselves from OOP as much as possible, so the class API was quite worthless. You clearly have no idea what you're talking about.
- antris 6y agoSigh... I am not trying to say React is bad. I'm just saying that for some people it's hard to learn because there are so many different things packaged there that it looks like a framework. I love React, I'm just saying it's not a perfect learning experience. If that's too harsh of a criticism about React to you, that's fine, but I am not interested in continuing the discussion as it is rapidly moving away from my original point and your tone is becoming hostile.