Gia's approach of putting component state into class properties and methods, rather than React's hooks that rerun on every render, provides a clearer and better mental model for managing interactive state.
CJ praises the new JS framework Gia for reviving class-based components for stateful UI, contrasting it favorably with React's hooks, which he criticizes as hard to reason about. ✦ AI generated
CJ Reynolds · Syntax · 2026-07-06 · original ↗
starts at this moment · 38:16
if you're going to build a component that needs internal state, you actually use a class component. So it kind of goes back to like the old React way of uh class extends component and then instead of a render function you have a template function. But what that means is you can have class methods.
verbatim transcript · starts at 38:16
37:57don't run over and over again. And the idea is if you're going to build a component that needs internal state, you actually use a class component. So it kind of goes back to like the old React way of uh class extends component and then instead of a render function you have a template function. But what that means is you can have class methods. So you can have like state update methods
38:16or effects but you just call them as instances on the class. And I actually like that I it's a better mental model for me in terms of what the code is actually doing versus how I write it. Because in React you have all these use effect use memo use callback. And it's very hard to reason about like what order does it get called in, where does it live, that kind of thing. So you
38:37essentially if you want a component that has state, you have to create a class that extends component. But they [snorts] also support functional components but purely for presentational UI. So the a functional component looks exactly like a function component would in react except there are no hooks. You can't have any use effects. You can't have any variables or state inside of here. It's purely presentational. And so
38:57I like that split where like if you want interactivity, if you want state, you have to put it into a class component and then you have to create methods on it. Um, so I I'm I'm I'm a big fan of that. Um, they have an example like there's a a doc on their site called React versus GIA. I would say take a look at that if you're a React developer
39:17to kind of see the differences. But there's a to-do app here in React. And this is kind of what I'm talking about. Everything is defined above the return. You've got your use state. you've got your methods, whereas if you contrast contrast that with GIA, your state are just properties on the class and then your methods to affect that state are are just methods on the class. Um, and I
39:36guess they actually separated that out into a store. So they you can have this stuff inside of a class component, but you could also have a separate object store that has all those methods on it and then use that store inside of your component. So um, I'm a fan. This feels yeah this feels like old React mixed with spelt and I think in a nice way um
39:55in the UI stuff like it being very CSS uh variable focused is great there some nice little examples inside of here. Uh it's interesting and I'm happy that someone's taking an approach like this. So I think it's fascinating. Am I going to reach for it? I I mean I'm I'm so firmly my tooling and everything is so firmly embedded in the spelt world that it's like I'm I going to have a hard