Skip to content

Instantly share code, notes, and snippets.

@vnglst
Last active April 30, 2018 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vnglst/cdff79e67cf57fc54a32577db9c7d28d to your computer and use it in GitHub Desktop.
Save vnglst/cdff79e67cf57fc54a32577db9c7d28d to your computer and use it in GitHub Desktop.
// AsyncPopup using renderProps
const AsyncPopupV2 ({ hasLoaded = false, renderContent }) => (
<View>{hasLoaded ? renderContent() : null}</View>
);
// example usage:
const App = () => (
<View>
<AsyncPopupV2
hasLoaded
renderContent={() => <DataComponent data={someData} />}
/>
<AsyncPopupV2 renderContent={() => <DataComponent data={null} />} /> { /* no propTypes error here! */ }
</View>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment