I wanted to see how I could achieve something as expressive as JSX but less verbose than using React.createElement. Using JSX requires at a minimum: node, npm, and Babel. Webpack if you’re handling other assets that Babel won’t handle for you.
From a beginners standpoint, it’s intimidating to take on so much knowledge before getting to Hello World. It’s not perfect, it’s just an attempt at something different with a specific set of constraints. It’d be great to have a single dependency that got you to the starting point right away. You could just us a link tag. Web development should be easier to get started with.
That's... the whole point of many, many projects like Create React App, React Boilerplate, et al. You use a script to get you to "Hello World" with all the stuff you'll actually use in the real world, rather than dinking around with things that you'll never use as they exist in production. It's better for beginners to learn in an environment that's solid and sustainable, rather than hoping to roll their own and learning in an environment with major issues.
Yes but they still require knowledge of command line node and npm. This may be necessary as projects swell and involve many devs. But for learning it all gets in the way to building something. It’s easy to forget how weird it was to learn all of this coming for websites built with jQuery or Vanilla JS.
No matter what you're doing, at some point you'll need to learn the command line and NPM to some extent anyways. It doesn't get easier than a tutorial of "install node by googling it and installing it from their website, then run npx create-react-app [app name]". They're arguably going to need to do vastly more to have a local server that's actually serving the html document that contains the javascript you need. After that initial "gimme an app", all you need on the command line is npm start until you want to get fancy.
I just don't get the point of a library that's not any easier than actual production stuff, with the only possible advantage being the ability to not have webpack or babel running, which prebuilt boilerplates handle for you anyways.
You’re right that, as of today, all that is necessary. My opinion is it shouldn’t be necessary.
I think the status quo is a burden and wastes mental cycles better spent creating something. <script> should be all that’s needed to get up and running.
And so I figure I try to see what it might look like if you start without it and this is where I ended up. You don’t have to use it or like it. It’s an experiment.
The biggest reason that more than a <script> is necessary... is that you first need to set something up to serve that <script>. You have to start up a server at some point, and a webpack-dev-server configured by CRA running with Node is one of the most painless servers to get going... ever. And it happens to also give you all the tools real work is going to use (or at least approximations of them).
You literally don’t need a server to use a <script> tag. You just need a raw JS file and a raw HTML file. Then open the HTML in a browser and: there’s your webpage! No server required.
Netflix, Amazon S3, or Github Pages offer (cheap or free) static file hosting that removes the need to think about a server.
Seriously, not every project needs all the tools you’re defending to get started, maintain, or host online. My argument is it’s possible to improve the dev experience without them. I find they are harmful to new devs and slightly annoying for more experienced devs: especially when they break.
And it's not like I'm advocating for a ton of tools. Just Node (which is useful for many things), Babel (which every site should use anyways so that people with browsers you didn't bother to check can still use your site), and webpack (which is immensely useful to know, and almost trivial to set up for simple projects anymore).
I think it's harmful to try and expose React with a weird API for the sole purpose of eliminating the need for supporting software. There's a reason we have the supporting software in most all projects, and why it's trivial to setup anymore.
0
u/[deleted] Jul 28 '19
I wanted to see how I could achieve something as expressive as JSX but less verbose than using React.createElement. Using JSX requires at a minimum: node, npm, and Babel. Webpack if you’re handling other assets that Babel won’t handle for you.
From a beginners standpoint, it’s intimidating to take on so much knowledge before getting to Hello World. It’s not perfect, it’s just an attempt at something different with a specific set of constraints. It’d be great to have a single dependency that got you to the starting point right away. You could just us a link tag. Web development should be easier to get started with.