Logo

dev-resources.site

for different kinds of informations.

React.useRefの理解を含めるエクササイズ

Published at
7/29/2023
Categories
react
useref
usestate
Author
kaerub
Categories
3 categories in total
react
open
useref
open
usestate
open
Author
6 person written this
kaerub
open
React.useRefの理解を含めるエクササイズ

document.getElementById vs useRef vs useState

違いはわかりますか…?
いつ使えばいいか迷ったら、ぜひ下記のエクササイズをやってみてください!

エクササイズはこちらです:

https://codesandbox.io/s/react-useref-t7pmkn?file=/read.me

プロジェクトでは4つエクササイズがあります:

  • エクササイズ1:src/components/Zero.tsx (document.getElementById vs useState)
  • エクササイズ2:src/components/First.tsx (document.getElementById vs useRef)
  • エクササイズ3:src/components/Second.tsx (useRef vs useState:useRefを使いすぎた場合)
  • エクササイズ4:src/components/Third.tsx (useRef vs useState:不要なレンダリング防ぎ方)

read.meを参考にしてください。

回答はこちらになります:

https://codesandbox.io/s/react-hooks-good-answers-6mhjcz?file=/read.me

useref Article's
29 articles in total
Favicon
How to create components interfaces using useRef/forwardRef/useImperativeHandle
Favicon
Hooks Behind The Scenes 3, UseRef!!!
Favicon
Mastering React's useRef Hook: Working with DOM and Mutable Values
Favicon
Understanding useRef: A Beginners Guide
Favicon
useRef Hook Explained
Favicon
useRef() in React . . .
Favicon
React State Management: When & Where add your states?
Favicon
Unlocking the Power of useRef: Besic to Advanced Examples for React Developers
Favicon
Leveraging useRef in TypeScript for Efficient DOM Manipulation
Favicon
Unlocking the Power of React Hooks
Favicon
React.useRefの理解を含めるエクササイズ
Favicon
Mastering React's useRef Hook: A Deep Dive
Favicon
Unlocking the Power of useRef in React: 12 Essential Use Cases
Favicon
Série React Hooks: useRef
Favicon
Toggle Password Visibility Using React useRef
Favicon
Stop using useState for everything
Favicon
Using React hooks to develop a Video Player
Favicon
React - How to load a form with the latest data
Favicon
React: сфокусировать поле ввода по чекбоксу
Favicon
How do I check/uncheck all checkboxes with a button In React Js using useRef() Hook ?
Favicon
Multiple item using one ref
Favicon
Closures and useEffects
Favicon
I need help. TypeError: Cannot read properties of undefined (reading 'current')
Favicon
Using React useRef Hook to access immediate past props or state.
Favicon
Compare Props in React Functional Components.
Favicon
Creating infinitely scrolling SPA using React
Favicon
useRef()가 순수 자바스크립트 객체라는 의미를 곱씹어보기
Favicon
Complete useRef() hook with live code examples
Favicon
Useful Patterns with React hooks

Featured ones: