I think the analogy is so apt because Dojo users made the same arguments back in the day; that it really was easy if you ignore all of the parts that were not easy. They weren't wrong! But that didn't make it ideal as a scaled down solution.
Same thing when you just include jQuery and plugins from a CDN.
> And if you make one mistake or do something not by the book you could easily wind up shipping the development version of React to your users (which is slower).
Same thing with using jQuery from a CDN.
React itself is also tiny compared to Dojo. And Dojo never did anything truly new. This is all old stuff re-packaged for the web. Web programming is still catching up with PC desktop programming from the 90's.
The new tutorial explicitly requires a build phase -- no more CDN and ad-hoc running.
1 - https://web.archive.org/web/20150202210539/http://facebook.g...
1 - https://cdnjs.com/libraries/react 2 - https://twitter.com/dan_abramov/status/893099358484353024?la...
The original tutorial allowed beginners to get started quickly (via CDN), even allowing them to write JSX via script tags in their HTML.
They can take that HTML and host it anywhere.
The new tutorial requires the usage of create-react-app or running the code on CodePen.
A tweet by a React core developer with instructions on how to get CDN support working better reinforces the point about not being open to amateurism, by the way.
Even jsx can be compiled on the browser, seamlessly.
I don't agree with that. I tend to prefer hyperscript to JSX (for personal projects) and I think it looks perfectly fine.
> I guess the argument is you shouldn't be compiling things on the clients browser.
How's that an argument at all?
var rootElement =
React.createElement('div', {},
React.createElement('h1', {}, "Contacts"),
React.createElement('ul', {},
React.createElement('li', {},
React.createElement('h2', {}, "James Nelson"),
React.createElement('a', {href: 'mailto:james@jamesknelson.com'}, 'james@jamesknelson.com')
),
React.createElement('li', {},
React.createElement('h2', {}, "Joe Citizen"),
React.createElement('a', {href: 'mailto:joe@example.com'}, 'joe@example.com')
)
)
)
...is just as readable as this? var rootElement =
<Div>
<H2>Contacts</H2>
<Ul>
<Li>
<H2>James Nelson</H2>
<A href="mailto:james@james.com">
james@james.com
</A>
</Li>
</Ul>
</Di>
The whole point of JSX is to make working with React more like html, because it is easier and more readable.> How's that an argument at all?
Huh? You mean, the argument that you shouldn't be sending un-compiled content to the client? I don't know why I'd have to argue for this, but render speed is one of the big reasons. Also download size. If you don't recompile, you have to include babel as well, on the client.
But even then, now you want people to learn a new tool to use React "simply"?
Did Dojo expect the community to use the "optional complexity"?
Actually now that browsers have fetch, async and await, you can do a lot with just those and document.createElement. No need for frameworks.
The point is not that scaled down is possible, it's that it's the way. It's not for the sake of learning, like the React with script tags tutorial. It's how people actually build things with jQuery; they just start hacking.
<div id="root"></div>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
<script type="text/babel">
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
</script>ng generate component my-component