Đang tải... (xem toàn văn)
Bài 3: ReactJS Tìm hiểu các Components trong React Trong bài này chúng ta sẽ tìm hiểu về các components trong React và cách quản lý chúng. STATELESS EXAMPLE Chúng ta tiếp tục sử dụng lại App.js, thêm vào 2 components đó là Header và Content, App sẽ chứa 2 component mới thêm vào, sau đó ta export thằng App. App.js
... Setup import React from 'react' ; import ReactDOM from 'react- dom'; import App from './App.jsx'; ReactDOM.render(, document.getElementById('app')); Và kết ta được: STATEFULL EXAMPLE Trong ví... TableRow nhận giá trị state component cha App (Chúng ta tìm hiểu kĩ state props sau) App.js import React from 'react' ; class App extends React. Component { constructor() { super(); this.state =... elements sau Index.js ta giữ nguyên code, import React from 'react' ; import ReactDOM from 'react- dom'; import App from './App.jsx'; ReactDOM.render(, document.getElementById('app')); Kết