News for hackers. Stuff that matters.
Re:The React Is “just” JavaScript Myth by ipsum2 on Saturday June 09, 2018 @05:53AM (#17272272)
> 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 plugin you need for your app.

> In my experience, there’s no casual mode within React. You need to be all-in, keeping up with the ecosystem, or else your knowledge evaporates.

This is not true at all. I use React for work and for pet projects, and I don't use or know what most of these libraries do. (We do use Redux).

It's easy to get caught up in library mania and chase after the newest javascript fads, but it is not necessary to build products.

Also, GraphQL is not tied to React or Javascript.

Re:The React Is “just” JavaScript Myth by maskd on Saturday June 09, 2018 @06:18AM (#17272329)
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 these other popular libraries around?

Re:The React Is “just” JavaScript Myth by madeofpalk on Saturday June 09, 2018 @08:55AM (#17272789)
And? It's a criticism or interesting observation that when you build large, complex applications that they can be large and complex?
Re:The React Is “just” JavaScript Myth by hungerstrike on Saturday June 09, 2018 @11:40AM (#17273527)
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 by sus_007 on Saturday June 09, 2018 @06:26AM (#17272344)
Just out of curiosity, what are your thoughts on Vue? I've heard a lot of good things about it.
Re:The React Is “just” JavaScript Myth by alayek on Saturday June 09, 2018 @08:29AM (#17272692)
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 and natural to compose various components - because it's a function calling another function.

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.

Coming from Angular 1, Vue JS would look feel like a breeze.

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.

Inside your template, Vue.config can be undefined; so you've to assign it to something in mounted(), and then get it to work.

Vue artisans tell me Vue supports "this" or "that". I don't want something that supports A or B - I want something where A and B are inherently supported from the ground up.

It's not all bad. VueX is pretty cool, kinda like Redux without the drama. And I cannot stress this enough - it's insanely easy to go through a Vue codebase and pick up the business logic of your app.

It still takes me some time to get used to a new React codebase.

Overall, I felt Vue is really good to build MVP and get your product off the ground, but it starts to show why you need React's discipline in your codebase with growing requests from users to add new features and support more platforms.

Then again, I'm new to Vue JS; so ask me again in a year. Am keeping an open mind.

Re:The React Is “just” JavaScript Myth by Can_Not on Saturday June 09, 2018 @02:34PM (#17274328)
> 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.

Re:The React Is “just” JavaScript Myth by ipsum2 on Saturday June 09, 2018 @06:39AM (#17272379)
I dislike the templating language, preferring jsx which is mostly standard js syntax, e.g.:

Vue: <li v-for="i in items">{{i}}</li>

React: items.map((i) => <li>{i}</li>)

Re:The React Is “just” JavaScript Myth by bartaxyz on Saturday June 09, 2018 @06:50AM (#17272405)
Just to make things clear. You can use JSX with Vue as well. It's even a recognized way to write code in the official documentation (https://vuejs.org/v2/guide/render-function.html#JSX). JSX is just a language that can be interpreted into code for React & Vue.
Re:The React Is “just” JavaScript Myth by Can_Not on Saturday June 09, 2018 @03:53PM (#17274661)
Not to mention that you can use Jade/pug, also.
Re:The React Is “just” JavaScript Myth by alayek on Saturday June 09, 2018 @08:33AM (#17272714)
I learned this the hard way, coming from React to Vue land; that v-for on an element would also repeat the element itself.

With React, it was pretty clear which element / component would repeat.

Re:The React Is “just” JavaScript Myth by Jare on Saturday June 09, 2018 @06:54AM (#17272416)
IIRC you can use JSX with Vue via a Babel plugin [1]. I can't vouch for it personally but it should be pretty easy to use.

[1] https://github.com/vuejs/babel-plugin-transform-vue-jsx#usag...

Re:The React Is “just” JavaScript Myth by Bizarro on Saturday June 09, 2018 @09:17AM (#17272865)
"Stringy code" is an issue, but it's more declarative and readable than JSX map.
Re:The React Is “just” JavaScript Myth by kyriakos on Saturday June 09, 2018 @09:37AM (#17272942)
exactly that. I prefer using javascript than inventing a template DSL
Re:The React Is “just” JavaScript Myth by Bizarro on Saturday June 09, 2018 @09:15AM (#17272851)
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 by balfirevic on Saturday June 09, 2018 @10:31AM (#17273208)
> 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 by Bizarro on Saturday June 09, 2018 @12:34PM (#17273754)
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 by mamcx on Saturday June 09, 2018 @03:54PM (#17274665)
For me, vue is more natural, as is easier to use html/css as "normal" and just spice things up with vue.

And it let me use LESS javascript. Less javascript is always good.

Re:The React Is “just” JavaScript Myth by petepete on Saturday June 09, 2018 @07:10AM (#17272454)
I love Vue, so much of what it does just feels right.

My one complaint is that Vue components place templating, code and styles in a single file and I'd prefer a directory with three (or more) separate files.

Re:The React Is “just” JavaScript Myth by JimDabell on Saturday June 09, 2018 @09:02AM (#17272808)
> My one complaint is that Vue components place templating, code and styles in a single file and I'd prefer a directory with three (or more) separate files.

You can have that. You do need an index.vue file containing something like:

    <template src="my-component.html" />
    <script src="my-component.js" />
    <style scoped lang="scss" src="my-component.scss" />
If you put that into a directory called my-component/ then you can just do:

    import MyComponent from 'my-component'
…and it will pull everything in.
Re:The React Is “just” JavaScript Myth by moltar on Saturday June 09, 2018 @07:31AM (#17272506)
I don’t think it’s a requirement. You can use Vue simply by including it from CDN and just sprinkle some functionality on a page.