Live data from Hacker News

An experienced Javascript developer’s account of learning React

medium.com

91–100 of 157 posts

Re: An experienced Javascript developer’s account of learning React

#91
post #31

Earlier quoted context omitted.

>writing no-framework javascript isn't difficult at all, If anyone recommends this without any concrete source code to illustrate the superiority of the advice, be skeptical for 2 reasons: 1) the programmer who rejects frameworks ends up writing another invisible framework that doesn't happen to have a name . Because the author is intimately familiar with his own code, he many not even realize that an implied framewo…

Imagine if I flipped around your statement and said - don't trust anyone who recommends the superiority of a framework without comparing absolutely every possible framework at their disposal and showing sample code to explain why a certain framework must be chosen. Are you up to this comparison task? Suddenly, the problem changes from "finding better tools for my job" to "evaluating some fairly opinionated peoples' v…

There are some traditional upsides/downsides to writing your own framework, but they should be evaluated for each case without blindly espousing one view or another - that said, for almost all business needs, you are probably better served by using an established framework.

Frameworks 1) Solve more difficult problems that most developers are not qualified to implement optimal solutions in a timely manner for (i.e. efficient algorithms, creating parsers for correctly parsing templates and avoiding security pitfalls, cross-platform rendering, avoiding cross-platform bugs such as browser-specific issues, etc.) 2) Have a publicly documented and established set of patterns/concepts (good for hiring - most developers do not want to learn a homebrewed system that likely brings less professional development benefits for their careers. Whether this is accurate or not in how it affects their careers is irrelevant, this perception is pretty strong from what I can tell anecdotally) 3) Avoids the significant cost of committing to R&D to reinvent the wheel, which most companies are not willing to do and/or does a disservice to companies financially

Homebrewing a framework, which is what you do when you avoid an existing one has these upsides 1) Building something that is potentially easier to understand (especially if built by one or a few people) 2) Potential for smaller JavaScript payload sizes

The upfront cost of creating a homebrewed framework is significant, and to be honest, going that route is probably technical malpractice for an engineer for almost all situations, even at bigger companies. I would be far more wary of any recommendation of homebrewing a framework than adopting an existing one maintained in the open by a community. The downsides of a framework not controlled by you are far outweighed by the downsides of creating one from scratch almost all the time. It is far more productive to participate in the community for a framework that is close enough to your ideal and influence the process that way than it is to burn it all down and suffer trying to solve the same problems in a more limited and likely worse way.

Re: An experienced Javascript developer’s account of learning React

#93
post #29

At our company, we have banned React, Angular and other "overengineered" JS frameworks. Our HTML is rendered from a standard boring Groovy server page, with some vanilla-js for DOM manipulations here and there. We have hired developers that were React fans, which quickly changed opinion that this old-school way for developing web applications is indeed better. It is faster to code, an order of magnitude easier to mai…

Replies like this are always interesting to me. It seems like you're saying these "overengineered" JS frameworks are useless, but I can't believe thats the case. You must just be saying they don't fit your use case, correct? If so you are not getting that point across very clearly.

Otherwise are you honestly saying you can't see the use case for these frameworks? You would rebuild Facebook with static HTML and a sprinkling of js? You believe all these very smart people who created, worked on, and use Angular, React, Vue, etc. are just way off base and should go back to your method?

Re: An experienced Javascript developer’s account of learning React

#94
post #65
post #62

Earlier quoted context omitted.

I had high hopes there, but I don't see an app, I just see enough boilerplate to put a Hello, world! into the DOM, which could have been done by just writing that into HTML. I can understand what it's doing, but I don't think it's a good example of how you can write an actual app without the parts people are mentioning.

You'd include all the modules as separate script files. Each script file is a revealing module[0] that exports its API to a global variable. If you're interested I could put together a more complete boilerplate. I don't actually use this approach much in front-end work these days, but it can be nice to work with just text editor and browser. As for building it, you're on your own. You could run jsx from the command l…

I may be wrong, but I use webpack to remove exactly the the pain point of running jsx from the command line, concatenating files and minifying them. It does good job there and saves me time.

Re: An experienced Javascript developer’s account of learning React

#95

Why is mixing HTML into your code in PHP bad? Because it mixes presentation and logic. Why is mixing HTML into your code in React good? Because it isolates all the view code for a single component in a single file.

In his example in the pre-preface there was quite a big amount of logic.. I don't really see the point in your post looking at that code.

The third paragraph was one that said that good PHP looks like React and bad React looks like PHP, but I deleted it because I thought it was stronger letting the reader make their own inference.

Re: An experienced Javascript developer’s account of learning React

#96
post #77
post #42

Earlier quoted context omitted.

React is for complex/dynamic UIs. By using canvas, you kind of admitted that the old-school way isn't good enough for that case. Having said that, if canvas works and is better than React for your case, then great! Use whatever works.

Its more like that we needed to display A LOT of data, that you also needs to interact with, much more than you can fit in a screen. So we present this with a simple way to navigate this data by using simple pan and zoom operations! Our clients love this!

I had a client request we put an entire 10k+ searchable and sortable product table on a single page (with thumbnails for every product). After much reservation and trying to convince them otherwise, we just did it.

After a few seconds of the browser creaking the page renders fine and runs great. This is a page with over 10000 images on it.

I highly doubt your canvas approach is needed.

Re: An experienced Javascript developer’s account of learning React

#97
post #72

Earlier quoted context omitted.

No adding/removing/modifying elements in a list is very simple and fast, even with thousands of elements. Example: https://pastebin.com/Fu39i47z

The good part about React is that given a `messages` data structure and a `render` function, it implements `addMessage`/`addMessageBefore`/`updateMessage`/`removeMessage` on its own. Writing once and not multiple variants of the same is good. Another good thing is that that there are a lot of components someone already published, that are ready to use (immediately, or after a few small fixes/PRs). The bad part is tha…

all the add/remove list stuff can be implemented by a simple templating library (handlebars/mustache) which doesnt mess up the whole client side architecture

Re: An experienced Javascript developer’s account of learning React

#98
I had similar thoughts when I first learned React. After building several UIs with it, I think the core thing that trips devs up is that it's very easy to make things far more complicated than they need to be. Beginner resources often don't help, either. Many of the boilerplate and starter pack examples you can find online have a ridiculous level of complexity in the file folder structure, component structure, dependencies, etc. - for example, no, you don't need half a dozen components spread across as many files to render a simple header or footer.

If you try to stick to a minimalist approach, it can be a pretty convenient framework. Definitely beats trying to do the same thing the jQuery way.

Re: An experienced Javascript developer’s account of learning React

#99
post #29

At our company, we have banned React, Angular and other "overengineered" JS frameworks. Our HTML is rendered from a standard boring Groovy server page, with some vanilla-js for DOM manipulations here and there. We have hired developers that were React fans, which quickly changed opinion that this old-school way for developing web applications is indeed better. It is faster to code, an order of magnitude easier to mai…

Replies like this are always interesting to me. It seems like you're saying these "overengineered" JS frameworks are useless, but I can't believe thats the case. You must just be saying they don't fit your use case, correct? If so you are not getting that point across very clearly. Otherwise are you honestly saying you can't see the use case for these frameworks? You would rebuild Facebook with static HTML and a spri…

There is a story called The Emperor's New Clothes, the morale of that story is that you should question your decisions and not blindly believe what other people say, even if you look up to them.

When I saw the "light" about React, me and friend were coding our own e-commerce system each for fun. Him with Ruby and Rails and jQuery, me with Grails and React. When we implemented the shopping cart, I wrote like 200 lines of code in React that would dynamically update that shopping cart. My friend did it with just 5 lines with jQuery. Yeah most of my React code was boiler plate, but still...

What I do, is not at Facebook scale, complexity or size. I have no idea about how challenging their issues are technically. What I do know as a user of Facebook though, is that Facebook is annoyingly slow these days, and makes my Macbook pro fan spin at full power.

Re: An experienced Javascript developer’s account of learning React

#100

I agree. React is a great rendering library which somehow became the core of a mix and match framework, plagued by backwards incompatibility and maintained by plethora of individuals. As a result upgrading dependencies is never safe and and each of tens of them is quite likely to introduce breaking changes or become obsolete, leaving you having to make unnecessary changes in your app. Don't get me wrong, I think Reac…

There are like 13 exposed functions in React: render, componentDidUpdate, componentWillUpdate...It's as simple as it gets. What breaking changes? The core API has changed little. And what they have changed is simple to adapt to. They've added stateless functions and switched to ES6 style classes and removed mixins.
Post reply on HN