function MemoizationPresenterPage() {
return (
<div>
<h1>이것은 프리젠터 입니다!!</h1>
</div>
);
}
export default memo(MemoizationPresenterPage);
const[counstState, setCountState] = useState(0);
const aaa = useMemo(() => Math.random(), []);
// => 렌더링이 되어도 aaa값은 변하지 않는다.
const aaa = useMemo(() => Math.random(), [countState]);
const aaa = Math.random()
// => state값이 바뀔때마다 (렌더 될 때마다) aaa값이 렌덤으로 바뀐다.
*** 특정 tag의 event 속성 안에 함수를 바로 선언할 수도 있다. 하지만 가독성이 안좋고 메모이제이션이 힘들어 추천하지 않는 방법이다.
<button onClick={() => {
setState(prev => prev + 1)
}}></button>
import styled from "@emotion/styled";
const Wrapper = styled.div`
width: 1200px;
height: 1200px;
background-color: red;
@media (min-width: 768px) and (max-width: 991px) {
width: 800px;
height: 800px;
background-color: green;
}
@media (max-width: 767px) {
width: 500px;
height: 500px;
background-color: blue;
// 모바일에서는 숨기고 싶을 떄
// display: none;
}
`;
// media 부분
export const breakPoints = {
tablet: "(min-width: 768px) and (max-width: 991px)",
mobile: "(max-width: 767px)",
};
import styled from "@emotion/styled";
import { breakPoints } from "../../src/commons/styles/media";
const Wrapper = styled.div`
width: 1200px;
height: 1200px;
background-color: red;
@media ${breakPoints.tablet} {
width: 800px;
height: 800px;
background-color: green;
}
@media ${breakPoints.mobile} {
width: 500px;
height: 500px;
background-color: blue;
// 모바일에서는 숨기고 싶을 떄
// display: none;
}
`;
export default function ResponsiveDesignPage() {
return <Wrapper>상자</Wrapper>;
}
Apollo 관련 내용을 시각적으로 볼 수 있다.
_app.tsx 에 connetDevtools를 true로 설정해야 한다.
const client = new ApolloClient({
link: ApolloLink.from([errorLink, uploadLink as unknown as ApolloLink]),
cache: new InMemoryCache(),
connectToDevTools: true
});