Last active
June 2, 2022 11:40
-
-
Save RoyalIcing/3bbba165ec282edf707894cb1f8f053c to your computer and use it in GitHub Desktop.
State Machine for simplified version of React’s rendering model
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
export function* ReactComponent() { | |
function* Initial() { | |
yield on("render", Rendering); | |
} | |
function* Rendering() { | |
yield on("resourceSuspended", Suspended); | |
yield on("error", Errored); | |
yield on("commit", Committed); | |
} | |
function* Suspended() { | |
yield on("promiseResolved", Rendering); | |
} | |
function* Errored() { | |
yield on("render", Rendering); | |
} | |
function* Committed() { | |
yield on("render", Rendering); | |
} | |
return Initial; | |
} |
Author
RoyalIcing
commented
Jun 2, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment