Next.js Discord

Discord Forum

getServerSideProps not working.

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Avatar
Giant pandaOP
Hello. Im using next.js getServerSideProps to render my guilds. But if i visit the page nothing happens. Im not receiving any errors it just doesnt do anything. I tried to console.log but thats not working too.
 import { GetServerSidePropsContext, NextPage } from 'next';
import { fetchMutualGuilds } from "../utils/api";
import { Guild } from "../utils/types";

type Props = {
  guilds: Guild[];
};

export async function getServerSideProps(context: GetServerSidePropsContext) {
  console.log(context);
  return fetchMutualGuilds(context);
}

const MenuPage: NextPage<Props> = ({guilds}) => {
  return (
    <div>
      {guilds?.map((g) => (
        <div key={g.id}>{g.name}</div>
      ))}
    </div>
  );
};

export default MenuPage;
 

3 Replies

Avatar
Giant pandaOP
Image
Avatar
Giant pandaOP
no errors
Image
Avatar
Giant pandaOP
Does anyone know why?