{asyncCache => {
// load and store data for next renders
const users = asyncCache.read("users", () => fetch("/api/users"));
const social = asyncCache.read("social", () => fetch("/api/social"));
// check state of both requests
if (users.state === "pending" || social.state === "pending") {
return "Loading";
}
// use requested data when they are ready
if (users.state === "resolved" && social.state === "resolved") {
const twitterLink = social.payload.twitter;
return users.payload.map(user => (
`${user.name}, Twitter: ${twitterLink}/${user.twitterId}`
));
}
return null;
}}
);
export const App = () => (