SYNC-HP用のサンプル
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
577B

  1. import React, { FC } from "react";
  2. import { fetchGuitars } from "../lib/strapi";
  3. import { GetServerSideProps } from "next";
  4. import { Guitar, GuitarResponse } from "../type/guitars";
  5. const Ssr: FC<GuitarResponse> = ({ guitars }) => {
  6. return (
  7. <div>
  8. {guitars.map((guitar: Guitar) => {
  9. return <div key={guitar.id}>{guitar.attributes.name}</div>;
  10. })}
  11. </div>
  12. );
  13. };
  14. export const getServerSideProps: GetServerSideProps = async () => {
  15. const guitars = await fetchGuitars();
  16. return {
  17. props: {
  18. guitars,
  19. },
  20. };
  21. };
  22. export default Ssr;