async-props
async-props copied to clipboard
Promise support
Hey, I’d like to use async-props
in my current project, but it lacks Promise support. How about mixing new and old school, huh?
If you like the idea, I’m willing to implement this feature myself.
static loadProps(params, cb) {
Promise.resolve({ilike: 'turtles'}).then(cb);
}
@kinday please do – I'd much rather Promise support than the old-fashioned callback approach. We could then go a step further with allowing static async function
:
static async loadProps(params) {
const user = await getUser(params.user);
const photos = await getPhotos(user);
return { user, photos };
}