๐ฅ๐ฒ๐ฎ๐ฐ๐.๐ท๐ ๐๐น๐ฒ๐ฎ๐ป ๐๐ผ๐ฑ๐ฒ ๐ง๐ถ๐ฝ๐
Write better React code. Follow these rules to keep your project clean.
Simplify your objects. Use destructuring to pull values. Use the spread operator to add new data.
Use function components. They are easier to read than class components.
Give each useEffect one job. Split a large effect into small ones. This keeps logic clear.
Avoid too many state variables. Put related data in one object. This prevents typos.
Destructure your props in the function signature. You see what the component needs.
Choose the right data tool for the job:
- Use useContext for wide components.
- Use props for isolated components.
- Use Redux for complex updates.
Source: https://dev.to/kkr0423/reactjs-clean-code-intermediate-180g