Hướng dẫn ReactJS ReactJS tutorial (p6) Bài 6: ReactJS Tìm hiểu về Component API

5 153 3
Hướng dẫn ReactJS   ReactJS tutorial (p6) Bài 6: ReactJS  Tìm hiểu về Component API

Đang tải... (xem toàn văn)

Thông tin tài liệu

Trong bài này, chúng ta sẽ tìm hiểu về 3 methods tiêu biểu trong React: setState(), forceUpdate và ReactDOM.findDOMNode(). Set State setSate() methods được sử dụng để update state trong component (xem bài 4 nếu bạn không biết state là gì), method này sẽ không tạo state mới mà chỉ update 1 state cũ có sẵn. Các bạn xem vd sau:

... React render lại component update state nó, đơi lúc muốn tự tay update mà khơng thơng qua state, ta cần đến Force Update: import React from 'react'; class App extends React .Component { constructor()... react-dom import React from 'react'; import ReactDOM from 'react-dom'; class App extends React .Component { constructor() { super(); this.findDomNodeHandler = this.findDomNodeHandler.bind(this);

Ngày đăng: 03/04/2018, 17:26

Từ khóa liên quan

Mục lục

  • Bài 6: ReactJS - Tìm hiểu về Component API

    • Set State

    • Force Update

    • Find Dom Node

Tài liệu cùng người dùng

Tài liệu liên quan