This course has been updated! We now recommend you take the State Machines in JavaScript with XState, v2 course.

Check out a free preview of the full State Machines in JavaScript with XState course:
The "Transient Transitions Exercise" Lesson is part of the full, State Machines in JavaScript with XState course featured in this preview video. Here's what you'd learn in this lesson:

Students are instructed to only allow authorized users to be able to drag the box element by using transient transitions.

Get Unlimited Access Now

Transcript from the "Transient Transitions Exercise" Lesson

>> All right, so in this exercise, yeah, you're gonna be starting with an initial state. And just like we showed in the slides, it's going to immediately move to idle if we're unauthorized, otherwise it's going to move to the unauthorized state. And so the idea is that when you go to, let's do Exercise 07.

[00:00:25] When the user is undefined, you should not be able to drag this. And right now, the user is undefined, so we don't want this to actually be draggable. So you could see here the user is undefined. So make it so that when our user is undefined, nothing should be able to happen over here.