React
React: Strict mode # useEffect # useRef
taltal
2024. 6. 13. 22:54
728x90
반응형
아래는 StrictMode를 살리면서,
useEffect를 통해 render 단계에서 commit 단계로 로직을 옮기고,
useRef를 통해서 추가적으로 발생하는 중복 요청을 막는 예제 코드:
(커밋 메시지에 구체적인 내용과 ChatGPT 설명을 추가함)
https://github.com/Junanjunan/g6_react/commit/fc642472500d8e262bfd7b701243e8ed2c2c55f2
[add] Restore React.StrictMode with useEffect and useRef · Junanjunan/g6_react@fc64247
StrictMode of React is recommended for robust development. When I need new tokens because of expiration of tokens, client request several times and I have problem that server's token and clien...
github.com
아래는 StrictMode에 대한 참고자료
https://jeonghwan-kim.github.io/2022/05/20/react-strict-mode
728x90
반응형