Notice
Recent Posts
Recent Comments
Link
250x250
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- vscode git clone
- 그누보드반응형
- 플러그인
- window 정책변경
- minwidth
- 글자들여쓰기
- MediaQuery
- 이미지반응형
- package.json
- googleicon
- node 오류
- fontawesome
- 정적객체
- 동적객체
- npm start
- react npm install
- legacy-peer
- node설치
- XEIcon
- maxwidth
- npm install
- slickslider
- Git clone
- npm install 문제
- 아이콘사용법
- owlcarousel
- 단어단위로떨어지기
- git lab clone
- 웹아이콘
- 의존성문제
Archives
- Today
- Total
어쩌다 알게 된 ƪ(•̃͡•̃͡ ƪ
다국어 처리 useTranslation() 훅 사용 본문
728x90
import { useTranslation } from 'react-i18next';
import { useCallback } from 'react';
const Profile () => {
const { t } = useTranslation();
const tr = useCallback((name) => t(`userDashboard.${name}`), [t]);
}
const translation = useTranslation();
const t = translation.t;
이걸 짧게 구조 분해 할당한 것이 아래처러 쓰는 것 (실무에서는 보통 이렇게 씀)
const { t } = useTranslation();
저렇게 하고 각 언어 폴더에 있는 userDashboard.json 안에 각 폴더에 맞는 언어를 적어주기
728x90
'개발 > 🟦 React' 카테고리의 다른 글
| React useEffect로 body class넣기 / 리팩토링 (0) | 2026.01.06 |
|---|---|
| ReactSortable 드래그, 솔팅 기능_리액트 라이브러리 (0) | 2025.12.31 |
| useRef로 resize width 계산 후 class 넣기 (0) | 2025.12.01 |
| useFormik 값이 무얼 뜻하는지 backend에서 찾기 (서버 전송) (0) | 2025.11.28 |
| <Portal>이란? _ 보통 모달을 많이 씀 (0) | 2025.11.26 |
Comments