React is a JavaScript library for building user interfaces, particularly single-page applications. It is maintained by Meta and a community of individual developers and companies.
React Anti-Patterns Overview
Prop Drilling
Huge Component Files
Inline Function Definitions
useCallback
to memoize functions.Not Using React Keys Properly
Overusing useState
useState
hooks for related data makes state management complex. Use useReducer
for complex state or objects with multiple fields.Side Effects in Render
useEffect
for side effects.Not Memoizing Expensive Calculations
useMemo
to memoize expensive calculations.Not Using React.memo for Pure Components
React.memo
to skip re-rendering when props are unchanged.Improper useEffect Dependencies
useEffect
can lead to stale closures and bugs. Always include all values from the component scope that the effect uses.Not Using Fragment for Multiple Elements
<>...</>
or <React.Fragment>
) to group elements without adding extra nodes to the DOM.Not Using Error Boundaries
Not Using Controlled Components for Forms
Not Using React DevTools
console.log
for debugging is inefficient. Use React DevTools for inspecting component hierarchies, props, state, and performance.