Hướng dẫn ReactJS ReactJS tutorial (p7) Bài 7: ReactJS Tìm hiểu về Component Life Cycle

4 195 3
Hướng dẫn ReactJS   ReactJS tutorial (p7)  Bài 7: ReactJS  Tìm hiểu về Component Life Cycle

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

Thông tin tài liệu

Lifecycle Methods • componentWillMount đây là method sẽ được thực thi trước khi 1 component được render trên cả server side và client side. • componentDidMount method này được thực thi khi 1 component được render trên client side. Đây là nơi các hàm AJAX requests, DOM or update state được thực thi. Method này cũng đucợ sử dụng để kết nối với các JS Framework khác và các function với delayed execution như setTimeout or setInterval. • componentWillReceiveProps sẽ được thực thi ngay khi thuộc tính props (tìm hiểu props là gì?) được update và trước khi component được render lại. Trong ví dụ dưới, ta sẽ sử dung method này vùng với setNewNumber để update state.

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

Từ khóa liên quan

Mục lục

  • Bài 7: ReactJS - Tìm hiểu về Component Life Cycle

    • Lifecycle Methods

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

Tài liệu liên quan