getServerSideProps undefined not working
Answered
Spectacled bear posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Spectacled bearOP
I have a component setup with a getServerSideProps and for some reason I got undefined for the initialUserData.
code:
code:
export async function getServerSideProps(context: any) {
// Fetch user data from Supabase using session
return {
props: {
initialUserData: "something",
},
};
}
function DashboardWrapper({ children, initialUserData }: any) {
const router = useRouter();
const [loading, setLoading] = useState(false);
const [stage, setStage] = useState("");
const [paymentModal, setPaymentModal] = useState(false);
const [type, setType] = useState("");
const [success, setSuccess] = useState(false);
const supabase = useSupabaseClient();
const [complete, setComplete] = useState(false);
const [discordModal, setDiscordModal] = useState(false);
const [userData, setUserData] = useState<any>({});
useEffect(() => {
console.log("initialUserData", initialUserData);
}, [initialUserData]);
![Image](https://cdn.discordapp.com/attachments/1139646574906056774/1139646575732342814/image.png)
5 Replies
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asian black bear
gSSP only exists for pages, not components
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Spectacled bearOP
Ohh
Is there any alternative solution?
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
Asian black bear
Pass data down from the page
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Spectacled bearOP
Okay