본문 바로가기

공부기록

공부기록, 2021-08-30(react 버튼)

- react 버튼
```
import React, { useState } from "react";
import { HashRouter as Router, Link, useParams } from "react-router-dom";
import { gql } from "apollo-boost";
import { useQuery } from "@apollo/react-hooks";
import styled from "styled-components";
import "../Components/css/styles.css";

const GET_MOVIE_INFO = gql`
{
movies {
id
title
}
}
`;

const MovieList = styled.div`
margin-top: 10px;
color: black;
`;

export default () => {
const { id } = useParams();
const { data } = useQuery(GET_MOVIE_INFO, {
variables: { id: parseInt(id) },
});
return (



{data?.movies?.map((m) => (
<>


{m.title}




))}


```
## 자주 하는 실수
- 기본기능으로 때우려고함
## 큐
- 어차피 헷갈리니 자주보고쓰자
## 내가 모르는 것
- react 버튼