Join us for React Conf on Oct 7-8.
Learn more.
logo by @sawaratsuki1004
React
v19.1
Learn
Reference
Community
Blog

    GET STARTED

  • Quick Start
    • Tutorial: Tic-Tac-Toe
    • Tư Duy Trong React
  • Installation
    • Creating a React App
    • Build a React App from Scratch
    • Add React to an Existing Project
  • Setup
    • Editor Setup
    • Using TypeScript
    • React Developer Tools
    • React Compiler
  • LEARN REACT

  • Describing the UI
    • Component đầu tiên của bạn
    • Importing và Exporting Components
    • Writing Markup with JSX
    • JavaScript in JSX with Curly Braces
    • Passing Props to a Component
    • Conditional Rendering
    • Rendering Lists
    • Keeping Components Pure
    • Your UI as a Tree
  • Adding Interactivity
    • Responding to Events
    • State: A Component's Memory
    • Render and Commit
    • State như một snapshot
    • Queueing a Series of State Updates
    • Cập nhật đối tượng trong state
    • Cập nhật mảng trong State
  • Managing State
    • Reacting to Input with State
    • Lựa chọn cấu trúc cho state
    • Sharing State Between Components
    • Preserving and Resetting State
    • Extracting State Logic into a Reducer
    • Passing Data Deeply with Context
    • Scaling Up with Reducer and Context
  • Escape Hatches
    • Referencing Values with Refs
    • Manipulating the DOM with Refs
    • Synchronizing with Effects
    • You Might Not Need an Effect
    • Lifecycle of Reactive Effects
    • Separating Events from Effects
    • Removing Effect Dependencies
    • Reusing Logic with Custom Hooks

Is this page useful?

On this page

  • Overview
  • Lấy ref đến node
  • Ví dụ: Focus vào text input
  • Ví dụ: Scroll đến một element
  • Truy cập DOM nodes của component khác
  • Khi React attach refs
  • Best practices cho thao tác DOM với refs
  • Recap
  • Challenges