Reactjs - Best Practices in Actions
Reactjs - Best Practices in Actions
tránh phải ../.. dẫn đến khó export const Loading = props => {
● css-loader
● postcss
○ Postcss-simple-vars
○ postcss-nested
○ postcss-import
○ autoprefix
Javascript
● UglifyJSPlugin
○ Remove console
○ Remove debugger
○ Remove comment
● DefinePlugin
Variable: this
● What is this?
● .bind(this)
● Syntax => ES6
Fonts, Images, Files
● import “logo.png”
● import “logo.csv”
● lazysize
Proxy
● JWT modify header
○ Why not just cookie
● CORS
○ Prefight Request với Options method
● Local Development:
○ Locahost:3000
○ Simple Proxy (alternative to nginx)
Components Communication
Redux
● Action
● Reducer
● Connect
● Dispatcher
● API
● Init
○ Cookie
○ Local Storage
○ Server Side
React Cycle
● construct
● componentDidMount
● componentWillUnmount
● componentWillReceiveProps
● shouldComponentUpdate
● render
State vs Props vs Context
● State
● Props
● Context
Composition vs Inheritance: HOC
● Inheritance
● Composition
● HOC
React Modules
● redux-form
● helmet
● fbemitter
● lodash
● query-string
● react-router
Unit Testing
● Jest - Test runner
● Enzym
○ mount
○ shallow
● Sinon
○ mock test
● Chú ý:
○ Test chỉ một file
○ Vượt qua nổi sợ khi viết test
Service worker
● Workbox plugin
● Runtime Caching
Performance
● Cơ chế render nhanh với thuật toán cho phép cập nhật lại thay đổi
● Thiết
Thinking in React
● vs Angular
● vs jQuery
Demo
https://thedevband.com/
● Online Unix Timestamp Converter
● https://github.com/enaqx/awesome-react
● https://github.com/brillout/awesome-react-
components
● https://thedevband.com/