props drilling

    react-query props drilling 피하기

    react-query props drilling 피하기

    react-query는 상태 관리 도구이다. 상태 관리 도구를 사용하는 이유 중 큰 부분을 차지하는 것이 props-drilling을 피하기 위해서일 것이다. 이 포스트는 react-query를 사용할 때 props drilling을 피하기 위해 고민했던 내용을 다룬다. 서버에 부담 주지 않기 react-query는 동일 키의 쿼리를 동시에 여러 개 요청하면 내부적으로 하나의 요청으로 만든다. export default function App() { const { data: posts1 } = useQuery(['posts'], fetchPosts); const { data: posts2 } = useQuery(['posts'], fetchPosts); const { data: posts3 } = use..