|
12345678910111213141516171819202122232425 |
- import React, { FC } from "react";
- import { fetchGuitars } from "../lib/strapi";
- import { GetStaticProps } from "next";
- import { Guitar, GuitarResponse } from "../type/guitars";
-
- const Ssg: FC<GuitarResponse> = ({ guitars }) => {
- return (
- <div>
- {guitars.map((guitar: Guitar) => {
- return <div key={guitar.id}>{guitar.attributes.name}</div>;
- })}
- </div>
- );
- };
-
- export const getStaticProps: GetStaticProps = async () => {
- const guitars = await fetchGuitars();
- return {
- props: {
- guitars,
- },
- };
- };
-
- export default Ssg;
|