Rewriting some old web portfolio projects, cutting out the jQuery & other stuff considered uncool by the in-kids

Rewriting some old web portfolio projects, cutting out the jQuery & other stuff considered uncool by the in-kids.
Thing is, all I see is that react.js seems like bullshit, it's just putting the html in the scripts.
What's the attraction & why is web-dev so fond of bandwagons?

Attached: 1_EntHChgUyirgbZ9A3zTxkA.png (900x675, 38K)

Other urls found in this thread:

github.com/Polymer/lit-html).
twitter.com/NSFWRedditGif

You don't need a framework to write a site. ES6 provides a lot of features that can easily replace everything you did in jQuery.

You don't do any manual dom manipulation anymore.
You just descrtibe how the DOM is supposed to look for for a given state, then react compares this goal state with your DOM's current state and computes the most efficient path to migrate and applies it.
Then, all you need to do is worry about manipulating the state. It makes a very clean separation of concerns.

Right & thanks. I'm using React.js for the experience & portfolio reasons
Still seems convoluted & like wheel re-invention, but I'm an oldfag & habits die hard.

Attached: 1523864547812.gif (480x480, 2.04M)

I also prefer the old way, for the most part.
For me, server side rendering will always be superior for websites. React has no place on those, all it does is slow shit down.

Web apps, on the other hand, do profit from libraries like that.
Though personally, I prefer lit html (github.com/Polymer/lit-html). Instead of inventing this shitty JSX syntax, which requires you to use a compiler (Using react without JSX is not a viable option, even though react tards [who've usually never used it] like to pretend it is), they use the native ES6 tagged template literals, and also use a more efficient system for updating the dynamic parts of the templates without React's virtual DOM approach, which requires rebuilding and diffing every single node after every state change, even static nodes.

Does this work for IE11?

angular is better

Don't waste servers on rending.
React is over complicated tough. It's for complex webapps not for good old simple websites.

Yes, you'll need a transpiler like babel though, to transform the tagged template syntax into something ES5 compatible.

Why not just use html?

>Don't waste servers on rending.
You don't really have to. For websites, you can usually use some cache like varnish with ESI. Then, delivering your pre-rendered content is just as performant as delivering static content, or the json you'd have to deliver to an SPA anyway.
SPA isn't a good pattern for websites. All it does is make people download more and delay the initial render time, which is often catastrophic for mobile phones on mobile networks, compared to just rendering pre-rendered and cached html with css right from the server.

Aren't you making people download more by having to download pre-rendered HTML than just simple data?

I don't see how that helps.

Browsers are incredibly efficient at rendering HTML. Downloading Data and Javascript, parsing, compiling and executing that JavaScript, then using it to parse the Data, then using that to generate the HTML and then rendering that HTML is usually going to be much slower. Especially on smartphones, and nowadays, many people use these to browse the web.

Try managing the state of something like facebook with plain JS.

React pays off for huge apps with complex state management, but it is indeed over complicated for simple sites. Just have to know when to use the right tool for the job.

What if my sites for not intended for mobile users to begin with? I get what you're saying that it's a lot easier to just plug and drop in HTML than having to build it, but does it really matter when mobile isn't your audience?

If it's out there then it is intended to be browsed on mobile. Everything else is just an excuse for being a lazy bum.

>If it's out there then it is intended to be browsed on mobile

It's really not though and unless you are on the internal wifi for the business it's located at you can't even access it with a phone. Not everything has to be made/gimped for a phone.

This.

If you are building a client’s website in react you are a stupid tryhard hipsterfag.

React was created to develop complex apps that are being developed by at least medium sized teams.

nu-js reinvents things that Java had decades ago
>tranaspile, minify, and then compress your code!
like a jar?
>uh, what is?

This. Jsx is indeed garbage. The component based methodology is much better. What Vue does as well.

why don't the in-kids like jQuery???!??!?!? it's all about the uberbloat frameworks like react and node and angular and vue now?

jQuery is my shit! just a nice layer on top of javascript so you can basically do javascript without all the verbose syntax and wrappers for stuff everybody needs to do. basically you could always go back and replace jQuery with vanilla JS, true, but it makes it unreadable and 10x longer. it's not some overblown "framework" that totally reshapes how you need to design an interface

Not really.

Even a simple search box that returns a list of links fetched from an API should be made using a front-end framework, not by handwriting everything that pertains to state, rendering, errors, caching etc.

The code will also be shorter, than if you wrote that in vanilla JS and HTML.

Of course, you should probably never write a simple landing page in React, especially if it's a static page. React makes sense when you have components which need to be updated, based on data input, searches etc.

you know you could just do ajax manually without needing react... if you have a simple website there is never any reason to use these uberbloat frameworks

they only make sense for webapps that are at a fairly high level of complication, but you can use just vanilla ajax or jQuery ajax to get the job done for simple stuff where you need to dynamically update the site with new info on the server side, or want to dynamically update stuff based on user input without submitting a form

Code Monkey at Facebook who writes React for 8 hours a day (not even joking). React has a LOT of really good benefits as a framework.

1) Super organized code. Because everything you do is isolated to React components, your code naturally becomes very hierarchical, and your code is structured like how your page is laid out. React code naturally becomes organized purely by the way that React components/child components work.

>But user, doesn't JSX/React couple Model/View too tightly?

That's why you use a data manager like Redux or Relay. React by itself is really shitty to write, but it becomes super powerful once you use a state/data manager. Yes, it's another framework, but if you're really concerned about another dependency, you can write your own version of Redux in an afternoon.

2) No direct DOM manipulation. It sounds like it'd be a terrible idea to abstract away the DOM, but overall there are VERY few cases where you need direct DOM control. React does a good job of handling DOM manipulation on its own.

3) Simplified application model. This is up to debate, but IMHO the React model is MUCH easier to follow and MUCH simpler to work with than many other frameworks. Your life becomes much simpler once you understand the React model and how to work within it. People who say it's complicated haven't spent enough time with it.

Realistically, it's just another framework. I like it, and it works well for a lot of use cases. But to each his own. :)

>it's just another framework

>React
>framework

Attached: 1529176627576.jpg (532x537, 34K)

thanks! could you comment on how React compares to Vue?

have you worked on smaller projects? at what level of sophistication for the project does it become beneficial to use a framework like react or node or vue or angular, as opposed to just home-brewing it with smaller stuff like DIY js/jquery/ajax?

DESU, I would use one of the bigger frameworks no matter what (I'm of course a fan of React, but any of the big ones are good to use). Yes, they do require a bit of setup, but I kind of equate not using of of these frameworks to writing assembly VS writing C (although it's not as drastic). You CAN use vanilla JS, but your app will become very unreadable and unmaintainable very fast, even if it's a simple one (at least from my experience). There's a reason these big companies put so much money into abstracting away direct DOM manipulation. :)

Mobile first.
Always.

i donno about that. i’ve set up some nice basic interfaces for guys working with me in a lab (like 8-12 frequent users) using just vanilla js+jQuery working with python cgi plus a mySQL backend, and none of them know react or any js framework. it’s just a few little one-pagers that give an interface to the data in the mySQL db.

i feel much better that if they needed to make some small mod to the interface, it’s simple JS instead of them having to figure out a framework’s conventions.

my point is that there IS a threshold where a project should use one of the frameworks, but below that, simple stuff is better

>python
They're probably using Django or the bottle framework

actually no, for this particular setup we run a java webapp developed by a larger, more pro group, and that webapp writes to our mySQL DB, and all we want to do in the lab is read what is in that db. so i wrote some python cgi that uses the python mysql connector to read it out

however the same people in the lab do have a separate setup for doing more complicated stuff that does use Django...

Reading this thread confirms that I'll never be able to be a web dev

why?

This might be advanced web dev, just start learning it small

react.js is meme hipster tier, just use views and express like a functioning person

not an argument.

>views
meant jade

Oh I'm sure I could learn it. But I much prefer systems programming and that sort of thing.

Webdev is too much bs for me and seems like every 2 years I'll have to learn the next *.js nonsense

>systems programming
like back-end developer?

t. hipster "developer"

still not an argument.

All memes aside, what frameworks should you actually have in your portfolio to get a JOB today?

asp.net mvc + asp.net web api

es6, outdated stuff like angular and react is a big -

node/react are the preferred meme frameworks to impress HR guys

angular is the sort-of-forgotten brother that some guys still use

vue is the renegade one-man-army alternative to all of them. it's legitimately the coolest of the quartet, but corporate folk don't like the idea of a one-man army upstaging them

yeah, hardware description, kernei level programming, that stuff

>angular is the sort-of-forgotten brother that some guys still use

>our super massive corporation just started moving to angular and a friend of mine got hired in NYC just to write angular frontends

You can use es6 with react

Attached: 1526588485206.png (469x452, 277K)

I use spring boot in combination with vue... Woks well for me

Is this bait? jQuery is shit for anything remotely complex since there is no two way data binding leaving you to implement something similar yourself which is very error prone.
I hate all web frameworks - jQuery for reasons stated above and the "kool" ones because they are fat sacks of shit (No framework should be over 100KB). Fuck front end cancer.