next.js / typeScript 사용 1. 체크된 상품의 productId 저장 const [checkItem, setCheckItem] = useState([]); 2. 체크박스의 체크상태를 관리 (초기에 모든 체크박스 상태는 ture) const [isChecked, setIsChecked] = useState(true); 3. 체크박스의 상태가 변경될 때 호출되는 함수 const handleCheckedBoxChange = (e: React.ChangeEvent) => { setIsChecked(e.target.checked); handleSingleClick({ checked: e.target.checked, productId: productId! }); }; e.target.value를 통..
function object({a,b}:{a:number; b:number}): string { return `${a+b}` } 객체로 넘겨줄때 {객체 명시} : {객체 타입 명시} : return 타입 명시 1. 비동기함수에서 사용해 보기 async funciton getPerson() { const res = await fetch(`http://localhost.5000/people`); if(!res.ok) { throw new Error(); } return res.json(); } getPerson().then((res) => console.log(res)) 아래의 객체를 받는다고 했을때 [ {id:1, age:20, height:180}, {id:2, age:28, height:170}, {i..

필요한 파일 vite.config.ts tsconfig.json vite.config.ts import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; export default defineConfig({ plugins: [react()], resolve: { alias: [ { find: "@", replacement: "/src" }, { find: "@page", replacement: "/src/page" }, ], }, }); { find: "@", replacement: "/src" }, 생성되는 파일은 src 아래에 존재할 것 이므로 "@" 는 " /src " 로 지정 { find: "@page", replace..
hover 마우스가 해당 요소 위에 있을 때만 스타일 요소 적용 See the Pen Untitled by 윤미주 (@yhjbuldw-the-flexboxer) on CodePen. active 마우스가 해당 요소를 클릭하는 순간에만 스타일 요소 적용 See the Pen Untitled by 윤미주 (@yhjbuldw-the-flexboxer) on CodePen. focus 마우스가 해당 요소를 클릭하고 부터 다른 요소를 선택하기 전까지 계속 스타일 요소 적용 See the Pen Untitled by 윤미주 (@yhjbuldw-the-flexboxer) on CodePen.
너무 간단해서 텍스트 쓸게 없지만.. import없이 환경변수 방법으로 가져와서 사용하면 된다!! 공식문서 https://create-react-app.dev/docs/using-the-public-folder/ Using the Public Folder | Create React App Note: this feature is available with react-scripts@0.5.0 and higher. create-react-app.dev
api 데이터를 받는데 시간이 오래걸려 loading중일때 보여줄 수 있는 페이지를 구현해야겠다고 생각했다. 기존에는 단순 이미지와 텍스트로 구현을 해두었었는데 너무 대충 만든 사이트라는 느낌을 주고 있는 것 같았다. 그래서 loadingbar를 만들어보자! 라는 생각으로 만들었다 import { useEffect, useState } from 'react'; import styled from 'styled-components'; export default function Loading() { const [filled, setFilled] = useState(0); useEffect(() => { if (filled setFilled((prev) => (pr..
하나씩 비교하면서 정리해 보겠다.. 먼저 tanstack-query에 대해 알아보아야 하지 않겠는가? 1. Tanstack-query 란? 주로 서버 상태를 관리하기 위한 도구로 사용된다. 서버에서 데이터를 가져올때 데이터를 업데이트할 때 데이터를 동기화할 때 발생하는 복잡성을 줄여준다! 이는 API호출을 통해 데이터를 가져오고, 그데이터를 UI에 표기하고자 할 때 매우 유용하다. 2. Tanstack-query 사용하는 이유 ! 💡 자동캐싱 : 데이터를 자동으로 캐시하고, 캐시된 데이터를 재사용함으로써 네트워크 사용을 최적화 하고 사용자 경험 개선 - 설명 : 성공적으로 패치된 데이터를 자동으로 캐시하고, 이를 통해 동일한 쿼리에 대한 중복 요청 방지 - 사용 방법: 지정된 쿼리 키(queryKey) ..
- Total
- Today
- Yesterday
- axios 사용하기
- 영화 별점
- Warning: validateDOMNesting(...): <li> cannot appear as a descendant of <li>
- Warning: A component is changing an uncontrolled input to be controlled.
- Warning: Each child in a list should have a unique "key" prop.
- axios instance 작성하기
- 에러모음집
- 별점 색채우기
- styled component 사용방법
- readme 작성해야 하는 이유
- 유효성검사 css
- readme 작성 방법
- Fetch와 Axios 의 장단점
- readme 이미지 추가 방법
- readme작성해보기
- nextjs 토큰 만료처리하기
- styled component GlobalStyle 사용방법
- axios CRUD
- axios 설치하기
- simple Icon 사용방법
- styled component 조건부 사용방법
- axiosinstance 사용 시 토큰 사용 법
- 별점만들기
- 영화별점만들기
- styled component 설치방법
- 유효성검사
- readme 역할
- git cache
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |