News for hackers. Stuff that matters.
Re:React from zero: a simple tutorial for React by rhapsodic on Saturday June 30, 2018 @11:02AM (#17431068)
For the life of me, I can't understand why React is as popular as it is. A web application is simply HTML, CSS and Javascript. Why do people want to make it so damn complicated?

I was around when browser based apps started to take over the enterprise software world. One of the big selling points was its simplicity compared to native desktop development languages like (horrors!) Visual Basic. Anyone could open up Notepad and create a simple HTML page with some form elements and a submit button.

Now, I realize that browsers' capabilities have advanced enormously in the intervening years, but it's still just HTML, CSS and Javascript, once the transpilers and the zillion other build tools get done with it. And I would argue that someone who really knows HTML, CSS and Javascript at a deep level can write it directly and maintain it a lot more efficiently than with a bunch of third-party frameworks and an overly-complex build process.

Re:React from zero: a simple tutorial for React by vbezhenar on Saturday June 30, 2018 @11:32AM (#17431180)
When people tried to write big enough applications with JavaScript, they found out, that it was a mess. JavaScript is a terrible language, so another languages were born (including modern JavaScript which isn't that bad). DOM is a very low level and very verbose API, so various approaches were taken to simplify development, e.g. jQuery, Angular, React. Hello world apps might be easy to do without frameworks, but once you're making complex pages with dozens of inputs, asynchronous loading, etc, lack of frameworks is likely to turn your code to a mess. Or, if you're brilliant developer, you might invent your own little incomplete buggy framework.

It's similar to WinAPI. Sure, you can write C with WinAPI and it's enough for simple applications. But in practice people use better languages and frameworks.

Simple JavaScript has its place, of course. If I'm making text-only website and I want to introduce just a little bit of interactivity, like image gallery, using anything but a few lines of JavaScript is overkill.

Re:React from zero: a simple tutorial for React by rhapsodic on Saturday June 30, 2018 @11:36AM (#17431194)
>When people tried to write big enough applications with JavaScript, they found out, that it was a mess.

I have written huge, complex, graphics-intensive applications with Javascript, and that was not my experience at all. So maybe it's not the language, but the person using it that is responsible for the mess.

> It's similar to WinAPI. Sure, you can write C with WinAPI and it's enough for simple applications.

That is a very far-fetched comparison, in my view.

Re:React from zero: a simple tutorial for React by abiox on Saturday June 30, 2018 @12:46PM (#17431500)
> So maybe it's not the language, but the person using it

oh. it would seem this is more about you feeling impressed with yourself, rather than making substantive arguments.

Re:React from zero: a simple tutorial for React by rhapsodic on Saturday June 30, 2018 @01:24PM (#17431700)
>oh. it would seem this is more about you feeling impressed with yourself, rather than making substantive arguments.

That is my argument. It's simple logic. If I can get good results without React, I've proven that React is not necessary to get good results.

Re:React from zero: a simple tutorial for React by abiox on Saturday June 30, 2018 @03:32PM (#17432359)
that seems like a trivially true statement, if not an outright tautology.
Re:React from zero: a simple tutorial for React by ricardobeat on Saturday June 30, 2018 @12:45PM (#17431499)
Do you use any framework, library or specific patterns in your apps?
Re:React from zero: a simple tutorial for React by rhapsodic on Saturday June 30, 2018 @01:27PM (#17431717)
>Do you use any framework, library or specific patterns in your apps?

Yes, but my team takes the same approach that Facebook or Google takes. We don't try to shoehorn in some general framework made for some other application by someone else. We make our own, that serves our own particular needs. We are the architects and the builders of our software.

Re:React from zero: a simple tutorial for React by DCoder on Saturday June 30, 2018 @11:56AM (#17431267)
> someone who really knows HTML, CSS and Javascript at a deep level can write it directly and maintain it a lot more efficiently

My brain cycles are limited. I would rather let my toolchain catch the trivial errors and focus on more important tasks. I love TypeScript and React/JSX for this – typechecking my code, including views with data bindings and event listeners, saves my sanity.

Re:React from zero: a simple tutorial for React by Kagerjay on Saturday June 30, 2018 @12:50PM (#17431525)
Frontend frameworks solve a need for SPA (Single Page Applications). While simple HTML/CSS/JS can handle simple static sites, something that needs reactive components (e.g. interacting with something on the site, and populating change instantly) is much easier in a framework. Javascript natively is quite difficult to do this and requires a lot of code to handle simple logic. This is what libraries are good for. React and Vue are such frameworks. These frameworks also allow for iOS and android integration as well.

However, I do agree with things being overcomplicated. I keep my tool chain process as lean as possible, with as few dependecies needed. I find it baffling that people would use React for something like an ecommerce site. Its all about the right tool for the right project. Not everything benefits from React, but some things do some things do not.

Re:React from zero: a simple tutorial for React by rhapsodic on Saturday June 30, 2018 @01:30PM (#17431730)
> Javascript natively is quite difficult to do this and requires a lot of code to handle simple logic.

Statements like this are what boggle my mind. I just don't see what's so damn difficult about native Javascript.

Re:React from zero: a simple tutorial for React by pault on Saturday June 30, 2018 @02:35PM (#17432059)
It's not JavaScript, it's the DOM and other browser APIs.
[dead]
Re:React from zero: a simple tutorial for React by dang on Sunday July 01, 2018 @02:19AM (#17434368)
Could you please stop posting uncivil comments?

https://news.ycombinator.com/newsguidelines.html

Re:React from zero: a simple tutorial for React by abiox on Sunday July 01, 2018 @11:19AM (#17435910)
hi, i noticed there isn't an option to delete my account, and the faq didn't address this from what i could tell. is there a recommendation here?