Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Summit
Mar 6, 2004

David wanted you to have this.

camoseven posted:

Found the guy who's still using Backbone and jQuery

Not sure how you made that leap. Right now I use React at work. NextJS for personal projects. My point was it’s better to keep an open mind and be able to see the value in any framework. They all have value. They will all also be replaced at some point.

Adbot
ADBOT LOVES YOU

camoseven
Dec 30, 2005

RODOLPHONE RINGIN'

Summit posted:

Not sure how you made that leap. Right now I use React at work. NextJS for personal projects. My point was it’s better to keep an open mind and be able to see the value in any framework. They all have value. They will all also be replaced at some point.

Found the guy who can't recognize jokes

HaB
Jan 5, 2001

What are the odds?

Sistergodiva posted:

Basically useState is you declaring a variable that should rerender the component if it chnages. If that variable came from a parent you wouldn't use. It's for something like a button setting the new value of the variable from inside the component. If it was something passed from the parent you would just have it as an arg in the component.

Ah gotcha. The Vue 3 equivalent of that is ref (for a primitive) and reactive for objects. They both give you a wrapped version of the value that Vue will see changes on and update accordingly. The difference is overhead. Since ref is only for primitives, it doesn't do a bunch of deep object checking for changes.


Summit posted:

I’ve never understood the desire to get fanboi about frameworks. They all suck. They are all great. If you use one it makes perfect sense. If you use the other it would make sense too. In some number of years we’ll all have moved on to something else. It’s the way of things.

Weirdly enough, no one is fanboying here. I mentioned I find JSX unreadable and why, someone else mentioned Vue is just as unreadable to them, and after that we've just been comparing poo poo in different frameworks. But no one is arguing that anyone else should change.

The Merkinman posted:

It's neat seeing the same thing in different frameworks. I'll throw in Angular.
code:
<Pin *ngFor="let pininfo of moduleData[currentFloor].pins" [pininfo]="pininfo" />
It's so incredibly similar to Vue, that I literally copy/pasted the Vue version and made a few edits

Yeah I started on AngularJS, and did some Angular 2 before moving to Vue. Vue to me, grabbed only the good parts from Angular and from React as well. You can even use JSX in Vue if you want to, and typescript is preferred over es6 at this point. They really make it feel like the "grabbed the good parts, trimmed the fat" framework.

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!
I can summarize frameworks like this:
Learn React, literally every company on the planet (except where I work???) uses it and if you don'[t know React then you're just wasting your time and will remain unhirable to any company ever.

HaB
Jan 5, 2001

What are the odds?

The Merkinman posted:

I can summarize frameworks like this:
Learn React, literally every company on the planet (except where I work???) uses it and if you don'[t know React then you're just wasting your time and will remain unhirable to any company ever.

Okay well this guy is fanboying. But no one before that was.

Macichne Leainig
Jul 26, 2012

by VG
React... good?

camoseven
Dec 30, 2005

RODOLPHONE RINGIN'

Protocol7 posted:

React... good?

The surprise twist NO ONE SAW COMING!

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!

HaB posted:

Okay well this guy is fanboying. But no one before that was.

I'm not. Just my experience when I was looking for another job during "the great resignation".

zokie
Feb 13, 2006

Out of many, Sweden
What fucks my brain up with all the template style frameworks is that it’s javascript (or typescript really) PLUS some weird custom template language thing that’s full of it’s own magic bindings.
With React have one thing, and if you hate JSX just don’t use it.

That makes thing so much easier to reason about or debug.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself

zokie posted:

What fucks my brain up with all the template style frameworks is that it’s javascript (or typescript really) PLUS some weird custom template language thing that’s full of it’s own magic bindings.
With React have one thing, and if you hate JSX just don’t use it.

That makes thing so much easier to reason about or debug.

yeah i had some gripes with Vue about this. You can either do 2-way data binding or 1-way, and if you've got more than a handful of devs on your team, you end up with different data binding methods in different components.

which isn't wrong, but i just found it annoying. i wish v-model and poo poo wasn't a thing

e: although i may be conflating my definitions because i suppose this is also 2-way data binding

HTML code:
<input change={changeState} value={stateValue} />
idk my point is i hate things like v-model where it's not explicit in the code where state is being updated

teen phone cutie fucked around with this message at 23:30 on Jun 9, 2022

Armauk
Jun 23, 2021


The Merkinman posted:

I can summarize frameworks like this:
Learn React, literally every company on the planet (except where I work???) uses it and if you don'[t know React then you're just wasting your time and will remain unhirable to any company ever.

Time to learn Vue and/or Svelte

prom candy
Dec 16, 2005

Only I may dance

teen phone cutie posted:

e: although i may be conflating my definitions because i suppose this is also 2-way data binding

HTML code:
<input change={changeState} value={stateValue} />

I don't think I'd really call this 2 way binding

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself

prom candy posted:

I don't think I'd really call this 2 way binding

ok good i thought i was going crazy because I was googling "2 way data binding in react" and then was reading this blog:

https://reactgo.com/two-way-data-binding-react/

and I thought i didn't know what 2 way data binding was.

prom candy
Dec 16, 2005

Only I may dance

teen phone cutie posted:

ok good i thought i was going crazy because I was googling "2 way data binding in react" and then was reading this blog:

https://reactgo.com/two-way-data-binding-react/

and I thought i didn't know what 2 way data binding was.

it's possible that I don't know what it is but I always saw it as like basically gluing an input to a variable. React doesn't have that (thank god) but you do still need inputs that show the value of something and also change its value so that's why you see the pattern above so much. But I don't think I would call it 2 way data binding since the getter and setter (for lack of a better term) are still separate and explicit

barkbell
Apr 14, 2006

woof
react has getters and setters

HaB
Jan 5, 2001

What are the odds?

teen phone cutie posted:

yeah i had some gripes with Vue about this. You can either do 2-way data binding or 1-way, and if you've got more than a handful of devs on your team, you end up with different data binding methods in different components.

which isn't wrong, but i just found it annoying. i wish v-model and poo poo wasn't a thing

That doesn’t sound like a Vue problem, but a code review problem. Bad code is framework-agnostic. That’s what code reviews are for.

I have heard ppl talk about data binding , and two-way vs one-way. But as I was writing this post I had to google two way binding just to make sure I understood what it was exactly. I found this definition which seems reasonable:

quote:

One-way data binding means that the variable is just bound to the DOM. On the other hand, two-way means that the variable is also bound from the DOM. When DOM gets changed, the variable also gets changed.

Isn’t that just how the frameworks work?

I guess I’ve either never understood what the problem is, assuming you are using :value to display something or v-model for something like a form field.

At any rate: v-model is just a shortcut anyway. These two things are equivalent in Vue:

code:
<input type=“text” v-model=“derp”/>

// vs

<input type=“text” :value=“derp” @input=“event => derp = event.target.value”>
but no one ever uses the 2nd way because why would you?

prom candy
Dec 16, 2005

Only I may dance

barkbell posted:

react has getters and setters

Yeah but referring to onChange= and value= as setter and getter feels a bit weird. I guess it applies though

Doom Mathematic
Sep 2, 2008

teen phone cutie posted:

ok good i thought i was going crazy because I was googling "2 way data binding in react" and then was reading this blog:

https://reactgo.com/two-way-data-binding-react/

and I thought i didn't know what 2 way data binding was.

Whoever wrote that article does not know what 2-way data binding is. Or what indentation is.

React does not have 2-way data bindings. AngularJS 1.x had it - it had four different kinds of binding in fact - and it was one of several very bad things about AngularJS 1.x which were rightly discarded for the generation of web frameworks which followed it.

2-way data binding, in the context of AngularJS 1.x, meant that an outer component could pass a particular variable down into an inner component. Whenever the outer component modified that variable's value, the inner component would automatically be passed the new value and re-render or update or something. But also, the inner component could modify the variable too, which would cause the outer component to be notified and then re-render or update. Not through a setter, the inner component would just assign a new value to that member variable. This arrangement - especially with 2-way bindings being passed down through multiple layers of components - made it maddening to track ownership of that variable, or predict what could cause the UI to change or when, or to establish some kind of flow of control in the application.

I don't know how this manifests in Vue. Most people who know Vue speak highly of it so I assume it's not so bad there.

Doom Mathematic fucked around with this message at 19:13 on Jun 10, 2022

Vincent Valentine
Feb 28, 2006

Murdertime

Doom Mathematic posted:

I don't know how this manifests in Vue. Most people who know Vue speak highly of it so I assume it's not so bad there.

The problem is that people generally spoke pretty highly of angularJS's two-way data binding as well. Blog articles would say "Hey you're doing this wrong! It's adding a ton of event listeners, it's obnoxious to follow, and honestly just bad!" and then if you looked at anyone's repos it was just wall to wall 2-way data binding. Literally every value passed was 2-way.

HaB
Jan 5, 2001

What are the odds?

Doom Mathematic posted:

Whoever wrote that article does not know what 2-way data binding is. Or what indentation

:words: about data binding

I don't know how this manifests in Vue. Most people who know Vue speak highly of it so I assume it's not so bad there.

Ah okay. That makes things clearer. I would say then that Vue (at least 3) doesn’t really have that. Or rather it strongly discourages it should you try it.

A child updating the parent is generally done via emit. But only the parent can mutate the state. (Or the store, in some cases).

Geebs
Jun 1, 2022

The ø is silent.

Doom Mathematic posted:

Whoever wrote that article does not know what 2-way data binding is. Or what indentation is.

React does not have 2-way data bindings. AngularJS 1.x had it - it had four different kinds of binding in fact - and it was one of several very bad things about AngularJS 1.x which were rightly discarded for the generation of web frameworks which followed it.

2-way data binding, in the context of AngularJS 1.x, meant that an outer component could pass a particular variable down into an inner component. Whenever the outer component modified that variable's value, the inner component would automatically be passed the new value and re-render or update or something. But also, the inner component could modify the variable too, which would cause the outer component to be notified and then re-render or update. Not through a setter, the inner component would just assign a new value to that member variable. This arrangement - especially with 2-way bindings being passed down through multiple layers of components - made it maddening to track ownership of that variable, or predict what could cause the UI to change or when, or to establish some kind of flow of control in the application.

I don't know how this manifests in Vue. Most people who know Vue speak highly of it so I assume it's not so bad there.

You're right, somewhere along the lines the term "two-way binding" was incorrectly re-used by some beginner tutorial writers to describe v-model in Vue (value in input tag changes, so does a local component). As you suspected, Vue does not have the "two-way binding" of AngularJS 1 and thankfully so. In no way can a component's child directly modify the state of its parent. To move data up to parents, it has an event system to "fire" event data to parent listeners, similar to Window.postMessage.

When multi-component state gets involved, it's all best managed centrally by Vuex (basically Redux).

HaB posted:

Ah okay. That makes things clearer. I would say then that Vue (at least 3) doesn’t really have that. Or rather it strongly discourages it should you try it.

A child updating the parent is generally done via emit. But only the parent can mutate the state. (Or the store, in some cases).

All versions of Vue did not have this, they learned from the mistakes of their predecessors!

barkbell
Apr 14, 2006

woof
why do people love to reach for redux at the first sign of component interaction

MrMoo
Sep 14, 2000

I think a lot of webdev is Pavlov reactions, there isn’t a lot of deep thinking going on.

Macichne Leainig
Jul 26, 2012

by VG

barkbell posted:

why do people love to reach for redux at the first sign of component interaction


MrMoo posted:

I think a lot of webdev is Pavlov reactions, there isn’t a lot of deep thinking going on.

Pretty much this, I'm guessing they haven't been graced with Context and multi-component state interactions yet.

Time and a place for Redux but if you've got a few pieces of state that a handful of components all operate on Context is perfectly fine.

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

barkbell posted:

why do people love to reach for redux at the first sign of component interaction

I agree that you probably don’t need redux for state, but if you’re doing a lot of actions within a lot of components, the action-reducer pattern is soooo much more manageable than passing hordes of little callbacks through props.

Nowadays you can replicate that with context and hooks, but the redux devtool is a pretty killer feature.

fsif
Jul 18, 2003

I don't work with super complex states all that frequently but Zustand has replaced the need for all redux and context-y things for me.

gbut
Mar 28, 2008

😤I put the UN🇺🇳 in 🎊FUN🎉


Any opinions on Recoil? I saw a demo a while back that looked promising.

prom candy
Dec 16, 2005

Only I may dance
Redux is insanely debuggable, more performant than hand-rolled context solutions, and with redux toolkit the boiler plate is mostly eliminated. I don't use it for everything but it's still a very relevant tool.

Macichne Leainig
Jul 26, 2012

by VG

gbut posted:

Any opinions on Recoil? I saw a demo a while back that looked promising.

Yeah actually I've used this in a mid-sized app. I think I was using it in a Next.js app which HMR's a bit differently so I ended up having to suppress a warning because HMR would re-register an atom (though it said it's harmless in dev mode, just annoying to have it clog up the console).

Fairly unintrusive API otherwise, almost a drop-in for state hooks. I only used it for the really commonly reused state like user info, one-off DB lookups, etc.

Chas McGill
Oct 29, 2010

loves Fat Philippe
Zustand is great, I wouldn't go back to redux

prom candy
Dec 16, 2005

Only I may dance

Chas McGill posted:

Zustand is great, I wouldn't go back to redux

This looks really nice, I'm a big redux head but I'd give this a try.

I think one of the other reasons redux has really died down is for years most react apps did their data layer in redux and now there's a billion tools for fetching/caching data that are pretty nice to use (including rtk-query which is built on redux)

5 years ago redux would be the brains of my app, now it plays a much smaller role (if any)

barkbell
Apr 14, 2006

woof
I wrote angular before react, and when i switched over hooks had already been released.

I've just never been on a project where I've wanted to add it, and the projects that already had redux or any flux-like lib were a huge mess with anything and everything stuck in it.

From talking to coworkers who like redux, they are usually front-end only devs that use it to wrangle data from poorly written APIs into a form they want to use.

HaB
Jan 5, 2001

What are the odds?
So good options for app hosting these days?

Needs:

- my own domain name
- ability to run node apps
- if I can use sqlite, preferred, if not a suitable postgres/mysql/whatever will work
- terminal access would be nice?
- hopefully free, or very cheap

Suggestions?

kedo
Nov 27, 2007

Digital Ocean droplets are a good option and can be very cheap.

Chas McGill
Oct 29, 2010

loves Fat Philippe

HaB posted:

So good options for app hosting these days?

Needs:

- my own domain name
- ability to run node apps
- if I can use sqlite, preferred, if not a suitable postgres/mysql/whatever will work
- terminal access would be nice?
- hopefully free, or very cheap

Suggestions?

We're using Render after the Heroku GitHub authentication fiasco and it's been good so far.

Macichne Leainig
Jul 26, 2012

by VG

kedo posted:

Digital Ocean droplets are a good option and can be very cheap.

100% suggest DigitalOcean for this and they have very good guides on how to set up most of those services on a production server instance for most OSes they provide IIRC. You don't even need to be a DO customer for their guides but it's one reason why I love them.

gbut
Mar 28, 2008

😤I put the UN🇺🇳 in 🎊FUN🎉


kedo posted:

Digital Ocean droplets are a good option and can be very cheap.

I've been using DO for (too) many years now, and am looking into https://www.hetzner.com/ as an alternative for both personal and side projects. They are supposed to be similar in terms of the offering.

Macichne Leainig
Jul 26, 2012

by VG
Realistically there are a ton of VPS providers out there but not all of them are equal. You could get away with Vultr, Linode, DigitalOcean, Hetzner, some cheap poo poo off LowEndBox probably.

worms butthole guy
Jan 29, 2021

by Fluffdaddy
What's the best SFTP / FTP client for Windows? Mac user for many years going to Windows now

Adbot
ADBOT LOVES YOU

The Fool
Oct 16, 2003


I used filezilla last time I needed one

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply