Hướng dẫn ReactJS ReactJS tutorial (p9) Bài 9: ReactJS Tìm hiểu Events trong React

4 168 3
Hướng dẫn ReactJS   ReactJS tutorial (p9) Bài 9: ReactJS  Tìm hiểu Events trong React

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

Thông tin tài liệu

trong React Trong bài này chúng ta sẽ cùng tìm hiểu cách xử lý các events trong React. Simple Example Trong ví dụ này chúng ta sẽ sử dụng một component cùng với onClick event dùng để update state khi ta click vào button.

... Index.js import React from 'react' ; import ReactDOM from 'react- dom'; import App from './App.jsx'; ReactDOM.render(, document.getElementById('app')); Kết ta được: Child Events Khi muốn... ); } } export default App; Index.js import React from 'react' ; import ReactDOM from 'react- dom'; import App from './App.jsx'; ReactDOM.render(, document.getElementById('app')); Kết... component thơng qua prop (updateStateProp) Các bạn xem ví dụ sau: App.js import React from 'react' ; class App extends React. Component { constructor(props) { super(props); this.state = { data: 'Initial

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

Từ khóa liên quan

Mục lục

  • Bài 9: ReactJS - Tìm hiểu Events trong React

    • Simple Example

    • Child Events

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

Tài liệu liên quan