본문 바로가기

분류 전체보기91

Recoil 사용 연습하기 - 2 atom 의 value를 감지하기 위해서 useRecoilValue const isDark = useRecoilValue(isDarkAtom); useRecoilValue 가 atom 을 넣으면 atom 값을 반환한다. atom 의 value set하기 위해 useSetRecoilState(Atom) 이렇게 하면 setter function 받을 수있음 const setterFn = useSetRecoilState(isDarkAtom); atom 을 받아서 atom 을 변경하는 함수를 반환 setState 처럼 사용하면 된다. const toggleDarkAtom = () => setDarkAtom((prev) => !prev); atom 이 변경되면 컴포넌트도 변경된 값으로 다시 리렌더링 된다. 2023. 4. 3.
[ TIL ] React-router-dom v6 Nested Routes import {BrowserRouter, Routes, Route} from "react-router-dom"; import Coins from "./Coins"; import Coin from "./Coin"; function Router(){ return ( ); } export default Router; router 에서 중첩 route 를 만들고 싶은 곳에 * 붙여준다 그리고 중첩 route 만들고 싶은 component 에서 이렇게 해주면된다. https://velog.io/@cnsrn1874/React-Router-v6-Nested-Routes [React-Router v6] Nested Routes React-Router v6에서 nested routes를 구현하는 방법엔 두 가지가 있다... 2023. 3. 31.
[TIL] styled components styled component 로 props 도 넘겨줄 수 있다. const Box = styled.div` background-color: ${(props) => props.bgColor}; // props 도 넘겨줄 수 있다. width: 100px; height: 100px; `; const Circle = styled(Box)`{ border-radius: 50px; } styled(Box) 해 주면 Box 안의 모든 값을 상속받을 수 있다. const Input = styled.input.attrs({required: true, minLength:10})` background-color: tomato; `; tag 에 attribute 도 추가할 수 있다. import styled, {keyfr.. 2023. 3. 29.
[TIL] git The requested URL returned error: 403 해결 git add , commit 을 하고 push 를 하려는데 permisstion denied error 가 났다. 1. 먼저 git remote -v 로 origin 이 내가 push 하려는 레포 주소가 맞는지 확인한다. 아니라면 git remote set-rul origin "레포주소" 로 remote 를 설정해준다. 2. 아래 글 처럼 제어판 - 사용자 계정 - windows 자격 증명 - 일반 자격증명에서 git 을 선택하고 거기에 내 id와 pw를 입력해준다. https://itsjh.tistory.com/47 [Git] git error: 403 깃허브에서 소스 파일을 커밋 후 push 하려고 하는데 아래와 같이 403 에러가 발생하는 상황이 있다. unable to acess 'https:/.. 2023. 3. 28.