getServerSideProps undefined not working
Answered
Spectacled bear posted this in #help-forum
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]);
5 Replies
Asian black bear
gSSP only exists for pages, not components
Answer
Spectacled bearOP
Ohh
Is there any alternative solution?
Asian black bear
Pass data down from the page
Spectacled bearOP
Okay