In this article, I will introduce helpful tips to improve React development efficiency.
🐰 Remove .bind(this)
We can lose .bind(this)
by using arrow function.
import React, { Component } from "react"; |
😀 Stateless functional components
We should use “Stateless functional components”, if it is possible.
// Bad |
HOC + Functional Stateless Component is a good solution in stateless functional components.
🚌 Separate components by responsibilities
According to responsibilities, we should separate React components.
// Bad |
🐮 Use object-rest-spread
Let’s use object-rest-spread to update difference ditection in React state.
// object-rest-spread |
🚜 Follow Flux Standard Action
Flux Standard Action is a human-friendly standard for Flux action objects.
// Good |
🐯 Duplicated lifecycle methods
Please be careful the following methods. In the feature, them will be un-usable. It is useful command: reactjs/react-codemod.
componentWillMount
componentWillReceiveProps
componentWillUpdate
😸 Special Thanks
- https://qiita.com/mizchi/items/bcb1aef8d1f14f8d0b4a
- https://github.com/tc39/proposal-object-rest-spread
- https://github.com/acdlite/flux-standard-action
- https://medium.com/@nikolalsvk/loosing-bind-this-in-react-8637ebf372cf
- https://reactjs.org/docs/react-component.html
🖥 Recommended VPS Service
VULTR provides high performance cloud compute environment for you.
Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour).
In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!