-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed8592e
commit 969a2f4
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
'xstate': major | ||
--- | ||
|
||
An error will be thrown if an `initial` state key is not specified for compound state nodes. For example: | ||
|
||
```js | ||
const lightMachine = createMachine({ | ||
id: 'light', | ||
initial: 'green', | ||
states: { | ||
green: {}, | ||
yellow: {}, | ||
red: { | ||
// Forgotten initial state: | ||
// initial: 'walk', | ||
states: { | ||
walk: {}, | ||
wait: {} | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
You will get the error: | ||
|
||
``` | ||
No initial state specified for state node "#light.red". Try adding { initial: "walk" } to the state config. | ||
``` |