export async function getServerSideProps({ params }) { // Call external API from here directly const response = await fetch(`http://localhost:1337/categories?slug=${params.slug}`) const data = await res.json() return { props: { menuItems: data } } }
Drupal 7, 8, 9 & 10 | Decoupled Drupal | ReactJS | NextJS | Open Source Developer | JavaScript | Wordpress | Ecommerce | Codeigniter | Yii Framework
export async function getServerSideProps({ params }) { // Call external API from here directly const response = await fetch(`http://localhost:1337/categories?slug=${params.slug}`) const data = await res.json() return { props: { menuItems: data } } }