-
-
Save whichsteveyp/9ddf59d06fc608c13829cfd51b3083a5 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 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
// parent A wants to show a list | |
<GetLastNImagesOfType type="jpg" numImages={10}> | |
{(images) => { | |
return images.map(image => <span>{image.name}</span>) | |
}} | |
</GetLastNImagesOfType> | |
// parent B wants to show the images themselves | |
<GetLastNImagesOfType type="jpg" numImages={10}> | |
{(images) => { | |
return images.map(image => <img src={image.src} />) | |
}} | |
</GetLastNImagesOfType> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@iammerrick sure, no worries. The issue that would not be resolved is other things from the parent at time of render. This could be anything really, an example would perhaps be localizing:
or attaching a ref: