Created
July 23, 2018 14:33
-
-
Save ShMcK/70585e9b7a8fb70f65451724da416f74 to your computer and use it in GitHub Desktop.
decouple-state-as-prop
This file contains hidden or 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
import { withStatechart } from "react-automata" | |
import alarmMachine from "./alarmMachine" | |
const AlarmClock = ({ machineState }) => { | |
switch (machineState.value) { | |
case "Snoozing": | |
return <Clock /> | |
case "Ringing": | |
return <Clock ringing /> | |
default: | |
return null | |
} | |
}; | |
export default withStatechart(alarmMachine)(AlarmClock) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment