There are many techniques through which the performance of a React app can be optimized, some of them are as follows –
1. Using useMemo() –
- It is a React hook that is used for caching CPU-Expensive function.
- useMemo() hook can be used to cache such functions.
2. Using React.PureComponent –
- It is a base component class that checks the state and props of a component to know whether the component should be updated.
3. Maintaining State Colocation –
- This is a process of moving the state as close to where we need it as possible.