-
-
Save tdeekens/8805dc1bda9e4f11a99f582ae197f0e5 to your computer and use it in GitHub Desktop.
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
class RadioGroup extends React.Component { | |
render() { | |
return this.props.children({ | |
name: this.props.name, | |
onChange: this.handleChange | |
}); | |
} | |
} | |
class UIComponent extends React.Component { | |
handleChange = event => {}; | |
render() { | |
return ( | |
<RadioGroup | |
name="size" | |
value={this.props.tshirt.value} | |
onChange={this.handleChange} | |
> | |
{({ name, onChange }) => ( | |
<React.Fragment> | |
<RadioOption value="m" name={name} onChange={onChange}> | |
M | |
</RadioOption> | |
{/* two more of these with the respective props */} | |
</React.Fragment> | |
)} | |
</RadioGroup> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment