Skip to content

Instantly share code, notes, and snippets.

@qpfiffer
Created July 17, 2019 03:41
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 qpfiffer/179cd76bdc535fef1578fb384ebf144f to your computer and use it in GitHub Desktop.
Save qpfiffer/179cd76bdc535fef1578fb384ebf144f to your computer and use it in GitHub Desktop.
const userProfileIsOldEnough = () => {
return userProfile.age > 18;
}
export default { userProfileIsOldEnough };
import 'userProfileIsOldEnough' from 'comparisons.js';
const what = ({api}) => {
const userProfile = api.fetchUserProfile();
// Question: How can I allow userProfileIsOldEnough to access userProfile without
// passing it as an arg?
if (userProfileIsOldEnough()) {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment