I have a challenge where I need to pass multiple sets of sanity data into a component, but I am restricted to using getServerSideProps only once. How can I work around this limitation to include more than one set of sanity data?
pages > members.tsx
export const getServerSideProps = async ({props}: any) => {
//HERE I NEED TO QUERY 4 MORE DATA //
const query = `*[ _type == "teammembers"] {
_id,
name,
position,
bordercolor,
memberimage,
}`;
const members = await sanityClient.fetch(query);
return { props: { members } };
};
const teammembers = ({ members }: any) => {
return (
<>
<TeamMembersComponent members={members} />
</>
);
};
components > members.tsx
const TeamMembersComponent = ({ members }: any) => {
return (
<>
<MembersContainer members={members} />
</>
);
};
I also require access to other data, for example:
const query = `*[_type == "projectschema" && slug.current == $id][0] {
_id,
title,
categories[0] -> {
title,
},
date,
website,
thumbnail,
client,
company,
description,
}`;