Class component is an outdated and heavy syntax used to describe a React component. It is based on ES6 classes.
At Pepperbay we use function components, because the syntax is clearer and more concise and it allows us to use React Hooks, introduced in React 16.8.
To succeed in this step, you will have to convert all class components contained in ./src/Component
& ./src/App.js
with some constraints.
When you think your work is correct, run yarn test
. The integration tests will check that the components are still working as intended.
These constraints must be used every day in each of your developments.
Do only what you are asked to do. No more. Do not try to predict futur features, keep a code base simple and clean.
Do not add any dependencies to the project. All the ones you will need are already installed. Each additional dependency represents more and more kilobytes in production bundle, so always try to create feature yourself before including a new one.
Resources:
- BundlePhobia: Describes the size and composition of a dependency
- 3 Minutes with Kent · Concerning Libraries and Frameworks: Build or Install
Never. Mutations are bad. Mutations are the Devil.
Mutations introduce side-effects, and that is the last thing we want. Keep in mind that there is always a way to avoid mutations.
Based on this observation, everything (99.99999%) you are going to define (variables and functions) must be an ES6 const
.