본문 바로가기

co-cherry

검색하기
co-cherry
프로필사진 co-cherry

  • 분류 전체보기 (19) N
    • C (0)
    • Python (3) N
    • Unity (0)
    • React (9)
    • Springboot (7)
    • SQLD (0)
    • 독서 (0)
    • 웹 개발 (0)
    • 정보 (0)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2026/03   »
일 월 화 수 목 금 토
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
Tags
  • React
  • tanstack
  • annotation
  • 예외처리
  • 백준
  • 오류 #사용자계정 #빌드 #설치오류
  • SpringBoot
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록2026/03/15 (1)

co-cherry

커스텀 훅과 책임 분리

커스텀 훅을 활용한 로직 분리 커스텀 훅(Custom Hook)반복되는 로직을 React의 내장 훅을 활용하여 재사용 가능한 형태로 분리한 사용자 정의 훅 예를 들어, 같은 input 로직이 두 컴포넌트에 있다고 가정해보자. EmailInput (Before)import { useState } from "react";function EmailInput() { const [email, setEmail] = useState(""); const handleChange = (e: React.ChangeEvent) => { setEmail(e.target.value); }; return ( );}export default EmailInput; NicknameInput (Before)import {..

React 2026. 3. 15. 19:38
이전 Prev 1 Next 다음

Blog is powered by AXZ / Designed by Tistory

티스토리툴바