Home

React Best Practices 2021

Rendering

  1. Does the component support handling of a state under an enum status?
  2. Is there an error boundary to handle unexpected issues?
  3. Should the state be colocated?
  4. If using context, is the provider optimised to prevent re-renders?
  5. Are expensive initial state calculations lazy initialized?
  6. Does an expensive calculation require React.useMemo?
  7. Does an expensive component (due to large list or other) require memoisation?

Hooks

  1. Should the hook be abstracted?

Testing

  1. Does the test avoid implementation details?
  2. Do you need to test the hook?
  3. Are you validating the UI by the recommended order?

Repository

https://github.com/okeeffed/developer-notes-nextjs/content/react/react-best-practices-2021

Sections


Related