“Goodbye useEffect” Reaction

Поделиться
HTML-код
  • Опубликовано: 25 авг 2024
  • НаукаНаука

Комментарии • 183

  • @EwokPanda
    @EwokPanda 2 года назад +484

    The thing that drove me craziest about this presentation was the font that made parenthesis look like square brackets.

    • @Khari99
      @Khari99 2 года назад +14

      I literally wrote up an example with brackets just to make sure I wasn't losing my mind that it was an impossible syntax lmao

    • @douglee650
      @douglee650 2 года назад +1

      Double brackets are p sweet

    • @mfdebian
      @mfdebian 2 года назад +8

      OMFG that's what that was, I was tripping real hard on that, that font is nasty.

    • @Dgiulian
      @Dgiulian 2 года назад +8

      That's what he should've ranted about. I mean, who does that? I hope it's not his theme font.

    • @alexmachin1785
      @alexmachin1785 Год назад +1

      That was driving me nuts 🤣🤣🤣

  • @bigmistqke
    @bigmistqke 2 года назад +86

    His round brackets sure look squary

  • @John-Dennehy
    @John-Dennehy 2 года назад +49

    did I miss something? when did the presenter suggest old class components lifecycle effects were better? I don't see any bad faith argument

    • @mandel4065
      @mandel4065 2 года назад +46

      Yeah I watched about half of this and at no point did they actually disagree, Theo just made up some imaginary argument based on where he felt the presentation was going and then ranted against that lol

    • @TiberiusGracchi
      @TiberiusGracchi 2 года назад +6

      100%. I think there was a misunderstanding with what the presenter was saying and then kept going back to it for the whole video

    • @eagsalazar
      @eagsalazar 2 года назад +7

      Exactly, it's like please stop pausing to argue condescendingly about a point no one ever made. I'm a subscriber and I like a lot of this content, but man you should almost take this video down and repost one where you don't spend half the video totally in left field.

    • @dunkindonut771
      @dunkindonut771 2 года назад +6

      The irony is that Theo's assuming argument was _actually_ in bad faith. To my understanding, David brought up the React lifecycle methods _only_ to explain them in order to showcase how folks are applying useEffect to mirror lifecycle methods when they should NOT be doing so.

  • @eagsalazar
    @eagsalazar 2 года назад +10

    About "doing youtube well", as another very opinionated person with a big mouth I can relate but IMO (here *I* go) live streaming these videos is a bad idea for you. I'm sure if you'd watched his entire video first, kicked around your thoughts with some friends over lunch, then made the video, you would have spent a lot less time reacting to points he never made, could have built on the points you agreed with (all of them I think), come up with more interesting things you didn't think of on first reaction, realized that character attacks because of 1 line in one example are probably unwarranted (although calling them out as mistakes is fair), and generally made a video *way* more interesting and less frustrating for your viewers.

  • @kylebelle246
    @kylebelle246 2 года назад +78

    Hey. Love the no bullshit energy you give off in space like this where i feel everyone just follows or keeps quiet. Subbed to the channel.

    • @invictuz4803
      @invictuz4803 2 года назад

      I feel like I've seen this guy and his free flowing hair before, but not on this small channel.

  • @gavdev12
    @gavdev12 2 года назад +19

    Idk why everyone is saying you have such a different perspective. I think overall David’s talk was pretty good and imparted the correct mental model and strategies to help a lot of people struggling with useEffect hell, and that you largely agreed

  • @Ctrl_Alt_Elite
    @Ctrl_Alt_Elite 2 года назад +39

    Aspiring junior dev here. Really glad this was recommended to me as I got to hear an opposing view. As a newbie I'm prone to blindly accept info I get from presenters with more experience. Great content - very confrontational for my liking 😅😂 but great nonetheless 💯
    Edit: to be fair, after listening to the Twitch team rant... that does sound pretty stupid 🤷‍♂️ justified rant imo lol

    • @DanKaschel
      @DanKaschel 2 года назад

      In fairness, the views didn’t really oppose much. They mostly agreed except on some details and on how the information should have been presented.

    • @Ctrl_Alt_Elite
      @Ctrl_Alt_Elite 2 года назад +5

      @@DanKaschel you're not wrong, but my point was that it's nice be able to view the presentation from the perspective of "this is debatable" rather than a non-opposable standard.

    • @ayanamij
      @ayanamij Год назад

      @@DanKaschel I thought the same thing. Lots of rage only to mostly agree. 😂

  • @magiclover9346
    @magiclover9346 Год назад +6

    I love the call out on `If you are doing something inline in your component that has a bunch of complexity to it ie utilising multiple hooks, external state and computing new state'. Exposing the state of a loading modal/spinner comes to mind. Abstract it into its own hook and call it something that makes sense. It Keeps your JSX/TSX code leaner. Makes testing easier (testing hooks and functions is easier than testing components) and makes switching technologies easier. This is good stuff.

  • @seanknowles9985
    @seanknowles9985 2 года назад +5

    He wasn't saying old style component lifecycle events were better than hooks. Was merely giving context, history and highlighting limitations.

  • @maniaclizard
    @maniaclizard 2 года назад +2

    I wrote a chatbot engine SDK with xstate, which is now used in production. The issue with xstate according to my former colleagues using xstate configs is clearly developer experience.
    The biggest pain point to me is that is incredibly hard to follow state transitions in xstate, because of everything is tied together with strings. You can't just simply jump with your IDE from one state to another by clicking around in the state machine config. If the config grows with your app it quickly becomes hard to maintain.
    You will also need a lot of helper substates, which confused a lot of devs. My take on it: use state machines for simple or mature stuff. Don't use it when you need to heavily iterate over the code base for feature adaption

  • @RealWorldReact
    @RealWorldReact 2 года назад +3

    Reactathon 2023: Theo makes live calls from the Announcer's box...

    • @t3dotgg
      @t3dotgg  2 года назад

      Wait I’m so down for something like this tho

  • @heddshot87
    @heddshot87 Год назад +1

    I'm a junior web dev, and I _can't believe_ senior devs complain this much about the dependency array, cringe.

  • @hakawati9
    @hakawati9 Год назад +2

    This was annoying since he assumed so early on that the presenter was saying it was better with life cycle function. He never says that. Half of the video comments were a waste of time.

  • @krzysztofzabawa2212
    @krzysztofzabawa2212 2 года назад +6

    I think one of things that should have been disclosed at the very beginning of David's talk is that he's a founder and a major promoter of XState, so he will take each and every opportunity to convince you that you need it in your project. So yeah - built-in hooks are bad, XState is good. I find it rather hard to believe that he's very objective in his talk, it feels like he just uses it as a space to promote and find use case for his library.

    • @CottidaeSEA
      @CottidaeSEA 2 года назад +1

      I fully agree. He's using examples with poorly written code, barely functional code I might add, just so he can make XState look better.
      The issues that exist within React are more often than not due to asynchronous events and people simply not understanding the framework. You can't save yourself from idiocy. Even less so when you're the idiot yourself. That's part of why I dislike React however, because some hooks seem like what you should use when it's not at all what should be used. I want to add that this dislike is honestly easily fixed through better naming conventions.

  • @faraonch
    @faraonch 2 года назад +1

    I am glad you came with this. I criticized the talk with a comment on his video.
    Since he is only telling not to use useEffect but he did not come up with any!! solution how to do better, !... So literally the question everbody was waiting for in the talk... "How the f+"*ç should we fetch data"? (At least I expected something like react-query) or what else?

  • @osman3404
    @osman3404 2 года назад +6

    You were missing the point because David is NOT advocating using ComponentDidMount instead of useEffect LOOL

    • @t3dotgg
      @t3dotgg  2 года назад

      You're missing the point right now :^)

    • @elephant_888
      @elephant_888 2 года назад

      @@t3dotgg Okay guys, let’s put together some linting to highlight all these missing points. 🙃

    • @elephant_888
      @elephant_888 2 года назад

      The speaker’s `ComponentDidMount()` + coverage of the legacy LC methods were unnecessary, since everyone agrees they sucked. The criticisms of `useEffect()` had some good points, but the examples were generally oversimplified, and served disingenuous at times. I think the talk was poisoned by hyperbole. The speaker was trying too hard to be sensational instead of making simple good points.

  • @ciropantera123
    @ciropantera123 2 года назад +2

    Hey Theo. Love your vids, they resonate a lot with my work as a webdev. I am really interested in knowing how would you have re-architectured the ad section so that issue does not happen? Maybe make a video about it?

  • @ruhollahh01
    @ruhollahh01 2 года назад +4

    I learn a lot from your channel, thanks for that!

  • @ropfoo287
    @ropfoo287 2 года назад +2

    came for the rant - stayed for it! Much love

  • @IsThisBenton
    @IsThisBenton 2 года назад +5

    Is this video (that pretends "reacting" about the another video) paid by Facebook to justify the
    anoying changes made to the API each year?
    Their marketing is so good, I know because we have been fooled multiple times that their library and approach is best, even when they had software patterns not removed from license they still managed to make us use it anyway.
    They should be more fair with the community rather than compensate it by convincing us through marketing. It seems that now their best defense is mocking the people that criticize them.
    When we will switch to Vue, Angular or Svelte they
    will finally figure out that marketing instead of
    fairness towards community was a bad strategy.

    • @t3dotgg
      @t3dotgg  2 года назад +3

      I think about this comment a lot

    • @dannydevs
      @dannydevs 2 года назад

      "I always remind myself to not forget--it's all these similarly bizarre, and unique choices, that make React...React" ruclips.net/video/lGEMwh32soc/видео.html With Svelte and Solid coming up, and Vue 3's super composability (similar to React/Solid) and amazing, Svelte-like DX, devs no longer have to be held hostage by a React that really doesn't see the need to treat its dev community with care, love, and respect because it is so dominatingly popular. My prediction: React will have a presence for a long time, like jQuery, but also like jQuery, no one will want to learn it in about a year and a half or two. Vue will keep rising, a ton of talent will move over to Solid, and Svelte will be especially popular at the web site end of the website-web app spectrum. It's sad to see React devs' inner conflict with how much they hate how React makes their lives miserable, then trying to convince them that React was the right choice. Maybe at the time it was right, but things have moved on, while React keeps doing crazy stuff like rolling out good docs 3-4 years after hooks were released. That's insane. Oh yeah, and it looks like Vue Vapor (no v-dom strategy like Solid/Svelte) coming up, Vue will become even faster (Vue 3 got a lot faster). And, as one can see with the Vue 2 to Vue 3 migration, they will do a lot to make that migration smooth and as pain-free as possible.

  • @thegrumpydeveloper
    @thegrumpydeveloper Год назад +2

    I love the idea of xstate but in practice modelling every state of your app with a name is probably too much. Narrow down to just a component and you should have at most a few named states and values that go with them. You can manage it with form state and a few overall enum/constants without injecting another state library.

  • @asdfafafdasfasdfs
    @asdfafafdasfasdfs Год назад +1

    Hi Theo, could you recommend a React app example (or video / tutorial perhaps) to orient with for state management? I agree that state machines can be overkill, but not sure how to use the alternatives correctly.

  • @invictuz4803
    @invictuz4803 2 года назад +1

    Thanks for sharing your thoughts on David K's talk, really insightful review. I like how you tell us at the end of the video to watch the video lol.

  • @nahfamimgood
    @nahfamimgood 2 года назад +1

    How do i stay up to date with when these conforences are happening so i can watch live?

  • @farhanghazali4406
    @farhanghazali4406 2 года назад +7

    Thank god I use other UI frameworks rather than React, people are still debating useEffect vs class based components? LOL
    No wonder you love React. You like to use the f*** while _Reacting_

  • @o1o334
    @o1o334 Год назад +1

    Junior react dev here. Why isn't it just mounted(handler), updated([deps...], handler) and unmounted(handler)? wouldn't this be more concise?

  • @grif.n
    @grif.n 2 года назад +3

    Can anyone explain why useEffect should be used rarely and what should be done instead? If I want some state to change because some other state changed, should it just occur on every render (until it is no longer performant, where useMemo could be used)?

    • @t3dotgg
      @t3dotgg  2 года назад +7

      Why do you want to change state because of other state?
      Usually, state changing is because of an action, i.e. clicking a button. If clicking a button increases `count` by 1, and we want to display `count` squared, we can redefine `squareCount` every render for cheap.
      If you're waiting for data to come back and then transforming that data i.e. `fetch().then(d => setState(d))`, transforming and re-storing via Effect is a NASTY anti-pattern.
      All state that an action changes should be changed in the action. That's the part both David and I agree on here

    • @grif.n
      @grif.n 2 года назад +2

      @@t3dotgg Nice :) Thanks for the response! I'll keep this in mind next time I start importing useEffect hah

    • @amisckass9550
      @amisckass9550 2 года назад

      I think you talk about derive state?

  • @spirobel
    @spirobel 2 года назад +5

    Theo, can you please react to the "Looking at Xstate's source code" video on the channel by KevinGhadyani ? David is on there and I think the example picked there explains a much more valid use case for XState. It seems like he picked an example at the end that is probably better served by things like rtk query, react query etc. But this kind of rich, complex client side UI feature like presented in the conversation with Kevin, is where Xstate and react (as an app not just a "website") can really shine.
    I also think the video Kevin made about hooks and especially the useEffect hook deserves a lot more attention. He explains the useEffect hook as "memoization for side effects". That is a very unique way of looking at things, but it is essentially what is happening. Why apply the concept of memoization only to data structures and function calls? In the end an effect is also just an async function. This mental model can turn effects from this scary alien thing into something known and manageable.
    TLDR: maybe the critique of useEffect isnt in good faith. The audience probably knows it is not that serious, because it just serves as stylistic device to carry the conversation from the wider react ecosystem to the topic of XState. 😅 There are better examples for presenting the use case of XState. Please take a look at them tooo 😀👍

    • @t3dotgg
      @t3dotgg  2 года назад +4

      I have David coming on next week - gonna watch this video to prep for it 🙏

  • @deecee2204
    @deecee2204 2 года назад +7

    i wished i have learned react first rather than vue,. learning react after vue makes react a mess. everything a LOT easier with vue. a lot flexible too. well these learning curve i have to take :^)

    • @magical692
      @magical692 2 года назад

      Sincerely I wish I had Learnt vue before react

    • @deecee2204
      @deecee2204 2 года назад

      @@magical692 believe me its the other way around 😁

    • @magical692
      @magical692 2 года назад

      @@deecee2204 one man's food is another's poison 😹

  • @kris10an64
    @kris10an64 2 года назад +1

    The fact that you got mad at this guy who you eventually realized you agree with I think shows you were the one arguing in bad faith.

  • @J4j4yd3r
    @J4j4yd3r 2 года назад +1

    It feels to me like you misinterpreted the initial part of the talk as preferring component lifecycle hooks to useEffect; your rant(s) on that, while fun and quite correct, felt unneeded.
    No hate though, as I totally agree with your overall conclusion, and it's probably a good example of why his framing and presentation choices were ill-advised.

  • @ThugLifeModafocah
    @ThugLifeModafocah 2 года назад +2

    Man, this guy is the type of guy people call as "toxic". "...because one person I don't like..." etc etc ... I like him. Acid. No bullshit.

    • @neociber24
      @neociber24 2 года назад

      He like complaining and it's funny, sometimes is right others not.
      Not sure if is "toxic"

  • @jacksparr0w300
    @jacksparr0w300 Год назад

    How are we suppose to handle unmount scenario if not with useEffect?

  • @victorcercasin
    @victorcercasin 2 года назад +1

    As a beginner I didn't even notice there was a problem with useEffect... I did notice sometimes it triggers more than one time, so I use the flag workaround.
    Question. I use useEffect to fetch data when the page first loads "useEffect(( )=> { fetch( ) }, [ ])" and put a spinner up while it fetches. Is this bad? I can't think of a way to do it without useEffect.

    • @t3dotgg
      @t3dotgg  2 года назад +1

      Google search "react query" - let me know how it goes :)

    • @PrevalentAA
      @PrevalentAA 2 года назад

      Or use Suspense and react swr

  • @unknownheartless3472
    @unknownheartless3472 Год назад +1

    This is why reaction videos are almost always a bad idea, specially if you feel very passionate about the topic, since you'll tend to rant before having the whole picture

  • @lThePotatoCrew
    @lThePotatoCrew 2 года назад

    I know you have a video on Solidjs, but I curious as you mentioned: "Svelte will only be as good as what Rich feels like doing" , what's your opinion on Solid Js?

  • @brattonross
    @brattonross 2 года назад +5

    Spicy video, thanks for sharing your thoughts. I'm certain that a lot of people are learning things from this, myself included, even if you might feel like you are just ranting

  • @bruhgoaway4876
    @bruhgoaway4876 2 года назад +1

    As a relatively early dev, I think the tip on when to use useEffect at 12:45 is super useful. I totally agree that you should always have a variable in the dep array to better control when the hook triggers, but considering where you’re placing the hook is also important too.

  • @NateLevin
    @NateLevin 2 года назад +1

    The react-query counter-example doesn't hold up for me. You aren't using effects and you are putting the state mutation in event handlers, which seems to be the whole point of the talk. Perhaps I am misunderstanding.

  • @Ianstudent
    @Ianstudent 2 года назад

    In the execute on mount only once example 41:23, I tend to use this pattern for analytics.

  • @guygolan3685
    @guygolan3685 2 года назад

    i love this channel. im learning alot AND get to see those beautiful rants? subbed

  • @kelvindecosta5350
    @kelvindecosta5350 2 года назад +7

    25:54 Thanks for sharing this story!

  • @amitei1183
    @amitei1183 2 года назад +6

    Hi Theo! I've been watching you since the pokemon video came out. You're perhaps my favorite dev so far, like a chunk of fresh air in suffocating world of frontend (and React ecosystem especially).
    I am React dev myself, and it's really exhausting to see dozens of wheel inventions for even the simplest things, trying to glue together all of them, project to project.
    For the past year I've been working on a project with a lot of features, states, async logic and 100+ API endpoints. Things I struggle the most with are state and complex effects (which I have a lot). I use RTK and sagas, try to keep models apart from views, but I don't like how it turns out, the project is still a huge dump in my eyes.
    I don't even know what I wanted to ask at this point (probably "how would you manage big amounts of complex async logic that is spread among components"). Just wanted to complain a bit and say that you're a legend and your videos help me a lot. ❤

    • @t3dotgg
      @t3dotgg  2 года назад

      Join the discord if you haven’t already!!! We talk about problems like this a lot, just did a whole rant about sagas yesterday

    • @lightyagami5963
      @lightyagami5963 2 года назад

      @@t3dotgg where's the discord link?

  • @joejazdzewski
    @joejazdzewski Год назад

    I have heard of this button issue from streamers before, when it came back. It was a nightmare

  • @Ricardoromero4444
    @Ricardoromero4444 2 года назад +1

    Please make a whole video talking about svelte

  • @leonidpyrlya9795
    @leonidpyrlya9795 2 года назад +1

    Love the format! 🖤

  • @LandonGavin
    @LandonGavin Год назад +1

    Lost some respect for Theo in this video :( Too much hate for his old coworkers.

  • @CottidaeSEA
    @CottidaeSEA 2 года назад +2

    What I don't understand is why so many people think useEffect is anything but a convenient variable change listener. That's literally all it does.
    The only thing that warrants a "huh?" is that there's a dismount part that happens, which is obvious since your variable is yeeted and deleted when the component goes byebye.
    It's not so obvious that it happens and is why I believe the useEffect hook should require a cleanup function, just as it should require a dependency array.

  • @viniciusataidedealbuquerqu2837
    @viniciusataidedealbuquerqu2837 2 года назад +1

    32:20 oh ELM TEA all over again

  • @DrewIsFail
    @DrewIsFail 2 года назад

    Can someone link to the "use event" hook that's mentioned?

  • @AgainPsychoX
    @AgainPsychoX 2 года назад

    Thank you for the video, I was really mad myself for this guy being crazy on useEffect!

  • @yamiyuki1112
    @yamiyuki1112 Год назад

    I think engineering is about trade offs, we trade a set of problems with another set of problems that we are more comfortable to deal with.

  • @DevinRhode2
    @DevinRhode2 2 года назад +1

    Get Luke from LTT on to dive into Ping as a product

  • @lastink444
    @lastink444 Год назад

    Damn, Theo 9 month ago was WILD lmao

  • @flyinglow
    @flyinglow 2 года назад +1

    great content, thanks for the thoughts!

  • @gabriel_export
    @gabriel_export 2 года назад

    Can you please do a video on memoization in React?

  • @tylerthomas6932
    @tylerthomas6932 2 года назад

    I'm a junior front-end developer from South Africa and I love your content, I'm still trying to understand a lot of the concepts you brush over but it's definitely increasing my knowledge base. I've been working with React for about a year and a half now, about 3 months into NextJs. I'm still not comfortable with TypeScript but hope to get there soon.

  • @shitbreak2k
    @shitbreak2k 2 года назад +1

    Here i was thinking i wnet crazy watching this , thank god im not the only one !

  • @RaducuGabriel
    @RaducuGabriel 2 года назад

    how about null instead of [] for no dependency

  • @vorname1485
    @vorname1485 2 года назад

    David's most arguments are like: "bread is shit, because its not butter" and "electric stove is shit, because it doesn't have a fire". Some conclusion: "electri stove doesn't burn"

  • @austincodes
    @austincodes Год назад

    I think I've made the infinite loop mistake like twice maybe. It's not a big deal

  • @oscarmejia8306
    @oscarmejia8306 2 года назад +1

    I’m glad I found you

  • @therealPDOT86
    @therealPDOT86 Год назад

    45:14 this really triggered me and I started to aggressively type a comment and almost just closed the video but by the end of the rant you walked it back to distinguish sites and apps. All calm now, but I hope you work on your delivery because with the multiple instances of immediate condemnation and shit talk it was walking the line of unbearable.

  • @alext5497
    @alext5497 2 года назад

    Where does useMutate come from. I'm new AF.

  • @Slashx92
    @Slashx92 2 года назад

    I died a little when he said "this is not haskell, what are we doing?". Javascript in a functional style is so good wym a function inside a functions is bad?

  • @13odman
    @13odman Год назад

    It’s because the lifecycle shit was easy to reason with. It was obvious to the human brain.

  • @willmcauliff506
    @willmcauliff506 2 года назад +2

    Confused why you fixated on the class components slide and kept repeating “bad faith” claims. It was mentioned for like 30 seconds of the talk, not at all the main point.
    Felt like you were arguing with strawman points no one was making

  • @kein3001
    @kein3001 2 года назад

    Do you write unit test? or is it only when you know the code is fuckt and you want people to stop making a mistake?

  • @ClaudioBrogliato
    @ClaudioBrogliato Год назад

    37:15 isn't this kind of Redux?

  • @reactmagic2348
    @reactmagic2348 2 года назад +1

    love this dude

  • @klc3rd
    @klc3rd 2 года назад

    For me the thought process goes… oh I wrote a function and now the page doesn’t load, I better put it in useEffect lol

  • @joaomaia9140
    @joaomaia9140 2 года назад

    can you do a video on useEffect? Thank you!

  • @luisponce3580
    @luisponce3580 Год назад

    Lol, by the time I finished to watch this video Honeypot posted "Reactjs the documentary"

  • @kalahari8295
    @kalahari8295 2 года назад

    Saved me some shitt I didn't grasp ❤️
    😬 teams could get this uncomfortable? Oof
    Your website is 🔥

  • @AbhishekKumar-lp5rc
    @AbhishekKumar-lp5rc Год назад

    subbed for the rant

  • @victors16811
    @victors16811 Год назад

    28:08 hahaha I’m definitely wouldn’t like to work with this guy in the same team 😂

  • @Xania-js
    @Xania-js 2 года назад

    I am so confused by ur point of view, at some point u imply that useEffect is bad (but the old alternative is worse) and almost in the same sentence u order us to be happy with it?
    Disclosure, i am the author of xania view library (see krausest js benchmark) heavily inspired by react and I am looking for the good parts of react and 'useEffect' does not seem like it.

  • @enijar
    @enijar 2 года назад +1

    Whilst I agree with most of David's talk, Theo touches on almost all the parts of the talk that I took issue with, especially the good use cases that useEffect was intended for. Yes, there are some points David brought up that useEffect shouldn't be used for, but it feels like a lot of the other points he brought up were made either in bad faith or the alternative use-cases were not made clear beforehand. Loved this video Theo!

  • @denizorsel1029
    @denizorsel1029 2 года назад

    I have been developing for web for 25 years. Everything I worked with in frontend so far has been more of a bandaid for a broken system. And unfortunately for me React is no exception. I won't be shilling something else but there are much better technologies out there in means of developer experience. Honestly the name of the hook useEffect derives from handling side effects. Even that should be telling for an entire generation of puppeteering requirements of state management.

  • @jornejongsma
    @jornejongsma 2 года назад

    It was about here when in the original talk I couldn't take David's BS anymore. XState is cool, but react itself is already a kind of state machine, so for normal use cases, you really really don't want to use it

  • @jcollins519
    @jcollins519 2 года назад

    Require the deps array!? I think it's a bad idea. You can make any effect work properly WITHOUT a deps array(and it's far more readable).

    • @t3dotgg
      @t3dotgg  2 года назад

      I am fascinated. Please elaborate on how I could useEffect for something like a data fetch without a deps array of some form in a way that is more “readable”

    • @jcollins519
      @jcollins519 2 года назад

      @@t3dotgg Just tried to share a comment with a code sandbox link that might have been blocked. Let me know if you're able to see it

    • @rufatzeynalli5538
      @rufatzeynalli5538 2 года назад

      He is mainly focused on second arg in useEffect. like `useEffect(callback, deps

  • @andy_ppp
    @andy_ppp 2 года назад +4

    I've said exactly this, you never want the case do something on every render. It's almost like it should be a different hook useRender and useEffect(() => something) should strict equal useEffect(() => something, []). Apart from that I hate the use of the closure like this, it causes spaghetti code. In most systems passing variables explicitly is much better, react even demonstrates this with props...

  • @user-uv5py8zi1w
    @user-uv5py8zi1w Год назад

    Thank you for the content. It's exciting

  • @JackieTreehorn-xd
    @JackieTreehorn-xd 2 года назад +1

    Been waiting to catch you live to sub my twitch prime! Thanks for the good content as always theo man.

  • @AdamM
    @AdamM 2 года назад +1

    Do you have more videos on not using useEffect? I've never heard this argument but love what you said here. Interested in seeing it in practice.

    • @t3dotgg
      @t3dotgg  2 года назад +3

      Not yet - will do more React Query-esque content. I post snippets about this on twitter a lot - search my @ and "React query" for some :)

  • @ebrelus7687
    @ebrelus7687 Год назад

    13:40 Svelte

  • @krisnrg
    @krisnrg Год назад

    Just cause the lifecycle components were bad doesn’t mean useEffect is good. Why should you keep your own dependencies? Can you possibly be better at that than a computer. At work that’s all I see all day after we moved to react, issues with useEffect. It’s complete trash.

  • @VinnyXL420
    @VinnyXL420 2 года назад

    Yeah... some of these talks make me wanna go back to Angular...

  • @carlosazuaje8381
    @carlosazuaje8381 2 года назад +1

    i still dont know how use use effect to fetch data ONE TIME in a component. dude angular is so good at this point

    • @t3dotgg
      @t3dotgg  2 года назад +1

      Effects aren't for fetching data!!! Unlike Angular, you don't have to use every piece they give you for every problem you have. React Query is a great library for managing your fetches, async calls, etc
      Tbh it sounds like you need help managing that so def check it out :)

    • @carlosazuaje8381
      @carlosazuaje8381 2 года назад

      @@t3dotgg POGGER

    • @maurov2104
      @maurov2104 2 года назад +1

      @@t3dotgg So, when developing with React, we have to use yet another external library for a making a simple request, LOLLLLLLL

  • @flammea_
    @flammea_ 2 года назад

    Can someone change my mind on state machines?
    I think they are backwards evolution in some way. They do exactly the same thing if else statements do in every programming language. I can imagine an alternative universe where state machines were invented before if else statements, and in that universe, if someone was able to invent if else statements their pitch would be: 'it's just like state machines, but look at how much less stuff you can write.'

    • @t3dotgg
      @t3dotgg  2 года назад +2

      Didn't realize if-else statements were async 😂
      Seriously though, it sounds like the things you're building aren't particularly interactive. When an "action" or "event" (external, user-triggered, etc) can interrupt your logic, handling that isn't if-else-able.
      90%+ of the time, React-Query handles the async case well enough to bring you back into if-else land. For websockets, chat servers, video call apps, games, and pretty much everything other than "fetch", state machines are essential.
      You should try building a game :)

    • @flammea_
      @flammea_ 2 года назад

      @@t3dotgg That is very true. Apps I've been working on don't often rely on websockets so much that it would cause a problem like that.
      I'll keep that use case in mind next time I read about state machines. Thanks Theo for replying.

    • @flammea_
      @flammea_ 2 года назад

      Unrelated but I've been binging your videos the whole day. I feel like your content is exactly what I was craving at this point in my career. Keep It up!

  • @paulsanchez5030
    @paulsanchez5030 Год назад

    this guy is such a kid mate.

  • @AndiSyafrianda
    @AndiSyafrianda Год назад

    i love when u speed up video 0:51

  • @ollystoppa9155
    @ollystoppa9155 2 года назад

    Theo makes great vids but he doesn't rant well. Should ask Prime for some tips

  • @shunia
    @shunia 2 года назад

    I watched David K's talk like days ago and after watching this I have some different thoughts:
    Class component is easier for most of the developers to understand, just to know the apis and you are almost good to go; While functional component requires not just the mental model of [state] => UI, but also annoying re-renders when logic goes complex. I don't think it's about good or bad, cause they both serve well when needed. But yes I do agree it's much better from a code architectural perspective transitioning from class component to functional component.
    So I actually like how he represents at the first minutes by showing the not totally right but really easily understandable comparisons.
    And by the way what's the use cases that useSWR are bad? And what is the difference with useReactQuery? @44:44

  • @roberthall9452
    @roberthall9452 2 года назад

    Should have gone with Svelte.

  • @tanercoder1915
    @tanercoder1915 2 года назад

    if you could show a piece of code while you rant next time, otherwise I lost your trail of thought

  • @BoodskiBro
    @BoodskiBro 2 года назад

    Love a good rant!

  • @fischi9129
    @fischi9129 2 года назад

    It's better than class component but it's still kinda meh.

  • @sokacsavok
    @sokacsavok 2 года назад

    If you create an API and name is useEffect(), then get mad if people use it for side effect management, you are doing something wrong. React has the most idiotic function names. Sometimes I feel like, we get these names from someone who just really want to show off how much jargon they know. While not even being correct on their meaning.

  • @fuhoo5836
    @fuhoo5836 2 года назад

    nothing wrong with useEffect.