Live data from Hacker News

The React Is “just” JavaScript Myth

daverupert.com

31–40 of 45 posts

Re: The React Is “just” JavaScript Myth

#31
post #6
post #2

> React is so much more than “just JavaScript”. React is an ecosystem. I feel like it’s a disservice to anyone trying to learn to diminish all that React entails. React shows up on the scene with Babel, Webpack, and JSX (which each have their own learning curve) then quickly branches out into technologies like Redux, React-Router, Immutable.js, Axios, Jest, Next.js, Create-React-App, GraphQL, and whatever weird plugi…

Just out of curiosity, what are your thoughts on Vue? I've heard a lot of good things about it.

We're just finishing up porting our app from React to Vue and we're very happy with the results.

I don't really understand's the author's point about GraphQL and Axios. But React Router, Redux and its ecosystem of supporting libraries are issues in React development

Having state management (axios), a built-in router, "the" styling solution built into Vue is a big win for us. Single File Components (SFC) are a joy to work with.

I actually like JSX (which you can use in Vue too), and was worried about "stringy code" ala directives, but in practice it hasn't been a big deal. We also switched from Typescript to plain ES6 which is a big win in simplifying our code. I'm actually a big fan of static typing, but at the end of the day Typescript's complicated type system, typing file incompatibilities, and general fiddling around with types wasn't worth it for us.

Redux was just a nightmare for us to work with. A library on top of Redux like DVA https://github.com/dvajs/dva would've helped, but there's a very small community there. We went to Mobx State Tree for a while, but there were a bunch of issues there too.

I'm keeping an eye on Blazor for some administrative apps in the future, but for now we're very happy with Vue.

Re: The React Is “just” JavaScript Myth

#32
post #8
post #6

Earlier quoted context omitted.

Just out of curiosity, what are your thoughts on Vue? I've heard a lot of good things about it.

I dislike the templating language, preferring jsx which is mostly standard js syntax, e.g.: Vue: {{i}} React: items.map((i) => {i} )

"Stringy code" is an issue, but it's more declarative and readable than JSX map.

Re: The React Is “just” JavaScript Myth

#33
post #8
post #6

Earlier quoted context omitted.

Just out of curiosity, what are your thoughts on Vue? I've heard a lot of good things about it.

I dislike the templating language, preferring jsx which is mostly standard js syntax, e.g.: Vue: {{i}} React: items.map((i) => {i} )

exactly that. I prefer using javascript than inventing a template DSL

Re: The React Is “just” JavaScript Myth

#34
It's absolutely fine to adopt React piece by piece, I disagree entirely that it's an all-or-nothing proposition. I've converted a heavily used in-production service from 0% to 100% React over the course of more than a year. And this is an SPA, so over that year there was literally jQuery and React rendering to the same DOM. It works just fine, it's all just JS.

You don't have to use Redux etc. (but you probably do if you have sufficiently complex state). Even then, you can do things like have multiple stores in the same app. It's fine! It's just JS objects being spliced, merged, propagated. You eventually converge on a single store as the various React parts merge.

You don't need to use react-router, or even a router lib. It's probably better if you don't, given how many times that shitshow of an API has been completely rewritten. I took one look at it, could tell that this lib wanted to be fully in charge, and noped out. It's fine to manage browser URL state yourself, it's just JS and the browser APIs are OK for that nowadays.

Now we're in the process of adopting Immutable.js. It's fine, it's just fancier collections, with some conveniences and being able to use React.PureComponent 99% of the time without worry. So your codebase is 50% fancy collections and 50% JS natives? That's fine, don't worry about it, just write new components using Immutable.js if that's the direction you're going. Don't worry about the top-level Redux container not being an Immutable instance, just use it for the leaves then.

Server side rendering? I retrofitted that in a weekend by compiling the app as a lib with Webpack (project started as Gulp way back), included that in Node.js as an import. Worked just fine, nothing to it. Now we're generating PDFs using the same frontend code with Puppeteer and SSR, it's awesome.

The app is in a better shape than ever, a real pleasure to work with. Jest tests for React stuff, Mocha tests for other parts. And that's fine, no need to get all religious about which one is the "one true" framework.

Re: The React Is “just” JavaScript Myth

#35
post #23

Having an ecosystem does not, in my humble opinion, make writing a React application feel substantively different from writing a pure JS application. Yes, JSX is not part of the core language (yet), but it's the closest to pure JS we are going to get considering developers' need for an intuitive, expressive, and virtually bulletproof templating language. Before learning React, I built some decent-sized applications w…

Out of curiosity, what do you think about lit-html[1]? The main thing I’m interested in there is that it’s based on native web technologies so you don’t need the huge non-standard React stack just to be able to load a file. Having has similar experiences with frameworks in the past I’m increasingly inclined only to use things which are moving in the direction of web standards to reduce the amount of churn. 1. https:/…

Looks nice! I've thought about working with tagged template literals before, but I didn't know Google already had such a project.

On the flip side, I am apprehensive about it being run by Google. Look at what happened with Angular 1.x, which was also supposed to let you do data-binding without abandoning valid html completely.

Also, JSX offers some conveniences I'm not sure would be possible with tagged templates, such as not having to join an array explicitly after you map its data to markup. Edit: I stand corrected; lit-html supports mapping an array to markup naturally.

As far as churn, which in general is a valid concern, I don't think React is going anywhere in the foreseeable future; it, along with Vue, has gained developer mindshare even jQuery may not have enjoyed back in its glory day. Absent a totally unexpected breakthrough, or Facebook really dropping the ball on updates, I think React could easily be viable in 2025 or beyond.

Edit: lit-html is built with TypeScript, oh my! I will definitely be diving deeper into this project. Especially if I'm not building an SPA.

Re: The React Is “just” JavaScript Myth

#36
post #2

> React is so much more than “just JavaScript”. React is an ecosystem. I feel like it’s a disservice to anyone trying to learn to diminish all that React entails. React shows up on the scene with Babel, Webpack, and JSX (which each have their own learning curve) then quickly branches out into technologies like Redux, React-Router, Immutable.js, Axios, Jest, Next.js, Create-React-App, GraphQL, and whatever weird plugi…

[deleted]

Re: The React Is “just” JavaScript Myth

#37
post #31
post #6

Earlier quoted context omitted.

Just out of curiosity, what are your thoughts on Vue? I've heard a lot of good things about it.

We're just finishing up porting our app from React to Vue and we're very happy with the results. I don't really understand's the author's point about GraphQL and Axios. But React Router, Redux and its ecosystem of supporting libraries are issues in React development Having state management (axios), a built-in router, "the" styling solution built into Vue is a big win for us. Single File Components (SFC) are a joy to…

> Having state management (axios)

Axios is a http client library, not state management library, you're thinking of Vuex. That being said, I don't know why the author associates Axios with React ecosystem, it's just a library you can use with any of the client frameworks.

Re: The React Is “just” JavaScript Myth

#38
post #5
post #2

> React is so much more than “just JavaScript”. React is an ecosystem. I feel like it’s a disservice to anyone trying to learn to diminish all that React entails. React shows up on the scene with Babel, Webpack, and JSX (which each have their own learning curve) then quickly branches out into technologies like Redux, React-Router, Immutable.js, Axios, Jest, Next.js, Create-React-App, GraphQL, and whatever weird plugi…

Perhaps a more charitable interpretation of the article is that when writing a larger application in React you'll be led from React-the-library (which is "just JavaScript") into React-the-ecosystem, which looks less like "just JavaScript" and more like the other frameworks. You can definitely write your application in React without external dependencies, but how is a beginner expected to do that, especially with all…

I think the more salient point here is that React-the-ecosystem is just the JavaScript ecosystem. There were very few packages mentioned that are strictly only useful with React.

Re: The React Is “just” JavaScript Myth

#39
post #31

Earlier quoted context omitted.

We're just finishing up porting our app from React to Vue and we're very happy with the results. I don't really understand's the author's point about GraphQL and Axios. But React Router, Redux and its ecosystem of supporting libraries are issues in React development Having state management (axios), a built-in router, "the" styling solution built into Vue is a big win for us. Single File Components (SFC) are a joy to…

> Having state management (axios) Axios is a http client library, not state management library, you're thinking of Vuex. That being said, I don't know why the author associates Axios with React ecosystem, it's just a library you can use with any of the client frameworks.

Right, I got my "library with x in the name" screwed up.

I've found vuex much more pleasant to work with than straight redux. I wish Facebook would just come out with an "official stack" already and put something on top of plain Redux to make it more programmer ergonomic.

Re: The React Is “just” JavaScript Myth

#40
post #21
post #6

Earlier quoted context omitted.

Just out of curiosity, what are your thoughts on Vue? I've heard a lot of good things about it.

Have been developing with React for last 3 years, and recently started building with Vue JS. React's core philosophy is JS everywhere - there's no template, no HTML, no CSS; only JS. As much as possible, write JS, and if you can, pure JS. It has its benefits - you can have code formatter to format your JSX, unit test any part of your code, or write integration tests with mount, or write snapshot tests. Extremely easy…

> Vue is magic, and its own DSL rules will get in your way. For instance, inside the Vue templates you cannot use `this`. However, inside your methods and computed, you have to.

Except everyone seems to complain that "this" exists at all, but then it's confusing that "this" is implicit inside an objects own template?

The DSL is awesome, and what makes it even more awesome is that it's optional. Your options are HTML, Jade/Pug, JSX, and a literal vanilla function. After the compile process, the template ends up as a render function.

> Never could make ESLint work on my Vue files, tried all plugins. Some parts of the code it lints, and some parts of the code it doesn't.

I can't say for sure this was true a year or more ago (especially in that short time you couldn't tell which libraries supported Vue 1 or 2 or both), but today and for as long as I've remembered eslint has been working in my Vue component files and inside sublime linter. My biggest complaint is that I want reasonML.

Post reply on HN