-
-
Save bultas/ccf657bec0d2ac36f13ff90bd8f3c001 to your computer and use it in GitHub Desktop.
Which API do you prefer? Passing a function into the Ratio component or making a higher order component called Ratio you can use to configure a component.
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
<Ratio width={Ratio.OPTIONS.FLUID} x={3} y={4}> | |
{(width, height) => ( | |
<Chart id={this.props.id} width={width} height={height} /> | |
)} | |
</Ratio> |
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
const ConfiguredChart = Ratio(Chart, { | |
x: 3, | |
y: 4, | |
width: Ratio.OPTIONS.FLUID | |
}); | |
<ConfiguredChart id={this.props.id} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment