Skip navigation
❌ useState ❌ useReducer ✅ State machines
0:00 / 0:48

❌ useState ❌ useReducer ✅ State machines

Sandro Maglione

@SandroMaglione5.2K followers

Visit on X
278 likesDownloadOriginal post

13,420 views

❌ useState ❌ useReducer ✅ State machines

13 Comments

Comments from the original post on X (Twitter)

  • Michael's profile picture

    @DotsonZion

    ❌ React ✅ Svelte

    4 likes

  • David K 🎹's profile picture

    @DavidKPiano

    Amen

    4 likes

  • Wadiou's profile picture

    @wadiou_

    I've built before a similar thing only for a bit complex animations and it was very helpful,but for simple stuff usestate is more than enough it can be easily validated by agents

    1 like

  • Gabriel Moncha's profile picture

    @gabimoncha

    i've been sleeping on xstate for too long

    1 like

  • Vinny's profile picture

    @hot_town

    Haha cool.

    1 like

  • Chandraprakash Darji's profile picture

    @chandra_7852

    This is not built for simlar task, just use the useState and move on, i have implemented my state machine but it is only helpful when there is complex components. In my 200K Loc frontend code there is hardly 5 state machine, useState does most of the jobs done

  • meowhib's profile picture

    @meowhib

    i was thinking the same when i read @mattpocockuk 's post

  • Rodrigo Ehlers's profile picture

    @rodrigoehlers

    How is this related to React if at all?

  • Prateek's profile picture

    @prateekkathal

    Each one of them have a use of their own. Use them where they apply, don't just ❌ them out.

  • Sandro Maglione's profile picture

    @SandroMaglione

    Nah, I just cross them out, with linting as well

  • Romain Dev🅰️ & Sommeil's profile picture

    @Rom1_Dev_Sleep

    At 0:26 when the SM is idle, and the eg send success For me it should not be possible to allow to send a not available event, and it should be catch at compile time. While the state machine is declarative, the associated event mécanisme is not. That’s promotes unwilling behavior

  • Roo's profile picture

    @ai_tested

    Yeah no.. this is much harder to read

  • noor's profile picture

    @divdotdev

    bruh j use effect atom