> There's no reason why JSX had to be included at the same time with React.
Why? JSX was one of the main reasons React became so popular. What would you have instead of JSX?
> There's no reason for it to provide classes, the whole bells and whistles.
They didn't provide "classes whole bells and whistles". React came out before classes where even standardised in Javascript. And its original API of `React.createClass` was really no different from hundreds of similar APIs.
> When React released with so many features at once
What? Which "so many features"? It released exactly that: a VDOM library with JSX and an API that was not much different from those on the market. That was the main reason it gained this much adoption: it was very simple, easy to understand and get into.
> You have to introduce each concept in isolation and then build understanding of the whole from those parts.
That... That what React does. It introduces major new things with major new versions.
> 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.
> 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.
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.
Getting 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.
I'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.
> 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.
Sigh... 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.
> 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.
There are many different things packaged there now. When it as released it had maybe two concepts, and you could get started with it in under an hour.
> it is rapidly moving away from my original point and your tone is becoming hostile.
The original point you presented was: "There's no reason why JSX had to be included at the same time with React. There's no reason for it to provide classes, the whole bells and whistles. They could have released just the Virtual DOM part of the library" which just makes little sense. And I never moved away from it, showing how wrong your recollection of React is.
You yourself decided to move away from it somehow deciding to talk about Redux, and how it's hard to learn React today.
Indeed. When we did our first React applications without a JSX compile step, we even went further with the syntax with the power of functional programming. You could do stuff like:
div({className: 'm-3', onClick }, 'the text')
Or go an abstraction step further create your own elements as a function, that take in custom parameters:
I mean, isn't that line actually quite expressive? It felt powerful to build the DOM exactly as you needed. You could generate anything without having to worry about JSX syntax, cause it's all JS and you can abstract using all of your toolkit. And if something goes wrong, you never have to look at JSX documentation or the JSX compiler output.
For a long time React docs had a very prominent place for "React without JSX" that showed that JSX was nothing but a bunch of functions [1], and you could skip all of them by doing
var h = React.createElement
h(...)
A few people where doing that. And early on you could switch to Preact by substituting Preact.* functions for React.* functions in the transpilation tools.
Why? JSX was one of the main reasons React became so popular. What would you have instead of JSX?
> There's no reason for it to provide classes, the whole bells and whistles.
They didn't provide "classes whole bells and whistles". React came out before classes where even standardised in Javascript. And its original API of `React.createClass` was really no different from hundreds of similar APIs.
> When React released with so many features at once
What? Which "so many features"? It released exactly that: a VDOM library with JSX and an API that was not much different from those on the market. That was the main reason it gained this much adoption: it was very simple, easy to understand and get into.
> You have to introduce each concept in isolation and then build understanding of the whole from those parts.
That... That what React does. It introduces major new things with major new versions.