Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Latest commit

 

History

History
41 lines (22 loc) · 2.02 KB

FirstStep.md

File metadata and controls

41 lines (22 loc) · 2.02 KB

First step

Convert class components to function components

Introduction

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.

Todo

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.

Constraints

These constraints must be used every day in each of your developments.

Be lazy

Do only what you are asked to do. No more. Do not try to predict futur features, keep a code base simple and clean.

Dependency free (almost)

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:

Do not make any mutations

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.