r/javascript • • Jul 28 '19

ScriptUI: Write React without JSX

https://github.com/anater/ScriptUI
1 Upvotes

22 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Jul 29 '19

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.

1

u/Delioth Jul 29 '19

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.

0

u/[deleted] Jul 29 '19

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.

1

u/Delioth Jul 29 '19

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).

0

u/[deleted] Jul 29 '19

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.

1

u/Delioth Jul 29 '19

Well, those are servers, so...

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.