Created
September 23, 2018 22:02
-
-
Save ShMcK/82e1478bdbc7b83f86d2849d9a02b49b to your computer and use it in GitHub Desktop.
Conditionally rendered state components
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
<Display> | |
<Time /> | |
<ClockMachine.State | |
is="AlarmGroup.Ringing" | |
render={() => <AlarmSetIndicator ringing />} | |
/> | |
<ClockMachine.State | |
is={['AlarmGroup.AlarmSet', 'AlarmGroup.Snoozing']} | |
render={() => <AlarmSetIndicator />} | |
/> | |
<Controls> | |
<ClockMachine.State | |
is="Normal" | |
render={() => ( | |
<Button onClick={this.setAlarm}> | |
Set Alarm After 3 Seconds | |
</Button> | |
)} | |
/> | |
<ClockMachine.State | |
is="AlarmGroup.Ringing" | |
render={() => ( | |
<Button onClick={this.snooze}> | |
Snooze For 3 Seconds | |
</Button> | |
)} | |
/> | |
<ClockMachine.State | |
is="AlarmGroup" | |
render={() => ( | |
<Button onClick={this.unsetAlarm}> | |
Cancel Alarm | |
</Button> | |
)} | |
/> | |
<ClockMachine.State | |
is="AlarmGroup.Ringing" | |
render={() => <Ring />)} | |
/> | |
</Controls> | |
</Display> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment