I'm getting the below error using getStaticProps(). What's the problem here? Using nextjs and I'm passing the returned value as props to a component. I have no idea what's happening here and have tried several things (await, JSON.stringify()) but nothing is working. When I run the api route separately it works so I know the api route is good. Also when I use the names constant it works as well.
export async function getStaticProps(){
//const names = {fname: "jim", age: "bob", grade: 10}
const res = axios.get("/api/teacher/loadstudents")
.then(res=>{
console.log(res.data);
})
.catch(err => {console.log(err)})
const studentdata = JSON.stringify(res.data);
return {
props:{data: studentdata}
}
}
const TeacherMainPage = (props)=>{
var classCode = "XZLE123";
console.log("These are the props: ", props) ;