This project uses NPM for dependency management.
- Emotion
- Rebass
- dotenv
- Jest
- Eslint
- Prettier
- Stylelint
- Formik
- React-Testing-Tools
- In order to produce consitent react class component code, add React APIs at the top, and custom methods below the
render()
Note: With the new Hooks API coming soon, it probably makes sense write function components more, in general.
class MyComponent extends PureComponent {
statics
lifecycles
state
render()
------
MyMethod1
MyMethod2
...
}
-
Use
PureComponent
by default unless you need to optimize manually withshouldComponentUpdate
99% of the time we should be using PureComponent for class components. -
Add a displayNames `static displayName = "MyComponent";``
-
Be generous with comments there are various IDE plugins that can help automate it like this: Document this
-
In prop type definitions, don't use
object
,array
orany
. During development it's fine if you are not sure what the structure is. But 90% we should be usingarrayOf
,shape
,oneOfType
etc..