Go offline with the Player FM app!
130: David Khourshid - Building Better UI Components with State Machines
Fetch error
Hmmm there seems to be a problem fetching this series right now. Last successful fetch was on August 21, 2025 19:10 ()
What now? This series will be checked again in the next day. If you believe it should be working, please verify the publisher's feed link below is valid and includes actual episode links. You can contact support to request the feed be immediately fetched.
Manage episode 247888818 series 1401837
Topics include:
- What exactly is a finite state machine?
- Why trying to keep track of a component's status using boolean flags is leads to bugs and complex code
- Why it makes so much more sense to keep track of a component's state using some sort of label
- How simple it can actually be to implement UI component logic with a state machine and why you shouldn't think of it as complex or over-engineering
- How you can think of using state machines in UI programming to be like an inversion of the typical approach you may have taken in the past, where actions become scoped to certain states instead of actions needing to inspect the current state
- What events might look like in your state machine and where you're actually sending them from and to
- Advice for naming your events
- What it means to "transition" between states
- How using a state machine makes it easy to provide slightly different behavior for the same action based on the current state
- The benefits of visualizing your state machines
- Using the XState library to build state machines in JavaScript
Sponsors:
- Tuple, try the best pair programming app out there for free for two weeks
- DigitalOcean, get your free $50 credit at do.co/fullstack
Links:
- "No, disabling a button is not app logic.", David's recent article on state machines
- XState Docs
153 episodes
Fetch error
Hmmm there seems to be a problem fetching this series right now. Last successful fetch was on August 21, 2025 19:10 ()
What now? This series will be checked again in the next day. If you believe it should be working, please verify the publisher's feed link below is valid and includes actual episode links. You can contact support to request the feed be immediately fetched.
Manage episode 247888818 series 1401837
Topics include:
- What exactly is a finite state machine?
- Why trying to keep track of a component's status using boolean flags is leads to bugs and complex code
- Why it makes so much more sense to keep track of a component's state using some sort of label
- How simple it can actually be to implement UI component logic with a state machine and why you shouldn't think of it as complex or over-engineering
- How you can think of using state machines in UI programming to be like an inversion of the typical approach you may have taken in the past, where actions become scoped to certain states instead of actions needing to inspect the current state
- What events might look like in your state machine and where you're actually sending them from and to
- Advice for naming your events
- What it means to "transition" between states
- How using a state machine makes it easy to provide slightly different behavior for the same action based on the current state
- The benefits of visualizing your state machines
- Using the XState library to build state machines in JavaScript
Sponsors:
- Tuple, try the best pair programming app out there for free for two weeks
- DigitalOcean, get your free $50 credit at do.co/fullstack
Links:
- "No, disabling a button is not app logic.", David's recent article on state machines
- XState Docs
153 episodes
All episodes
×Welcome to Player FM!
Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.