Skip to content

Instantly share code, notes, and snippets.

Avatar

Austin Jones jonesaustindev

View GitHub Profile
@townofdon
townofdon / delay.js
Last active Dec 18, 2019
Simple delayed Promise
View delay.js
const delay = (callback, time = 5000) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, time);
})
.then(callback);
}
// USAGE
View providerCompose.js
function ProviderComposer({ contexts, children }) {
return contexts.reduceRight(
(kids, parent) =>
React.cloneElement(parent, {
children: kids,
}),
children
);
}