Stop mocking fetch
Discusses the pitfalls of mocking API clients in tests and suggests mocking `window.fetch` directly for better confidence.
KentCDodds.com is the personal website and blog of Kent C. Dodds, a software engineer, educator, and open-source contributor known for his work in the React ecosystem. He writes about modern web development, testing, accessibility, performance, and developer experience, focusing on how to build reliable, maintainable, and scalable applications. Kent is the creator of popular libraries such as Testing Library and Remix, and his articles often highlight practical approaches to writing better React components, handling state, and improving user experience. Beyond tutorials, the site features courses, workshops, podcasts, and conference talks, all aimed at helping developers learn by doing. With his teaching-first philosophy and clear explanations, KentCDodds.com has become one of the most trusted learning resources in the React and JavaScript community.
194 articles from this blog
Discusses the pitfalls of mocking API clients in tests and suggests mocking `window.fetch` directly for better confidence.
A detailed guide on the author's process for creating concise, high-value educational videos, focusing on preparation and content structure.
A practical guide to Test-Driven Development (TDD), explaining the red-green-refactor cycle and when it's most beneficial to use.
A guide for developers on when to prioritize writing tests versus fixing bugs, based on cost-benefit analysis of different scenarios.
The article introduces AHA Programming, a principle advocating 'Avoid Hasty Abstractions' and preferring duplication over bad abstractions for more maintainable code.
Explains how to use React's experimental interaction tracing API to monitor user actions and their performance impact.
How using ESLint, Prettier, and TypeScript as static analysis tools can help eliminate common bugs in JavaScript development.
Tips for intentionally building your career and personal brand to gain job security, confidence, and career flexibility.
A guide to improving test error messages when creating abstractions in JavaScript testing frameworks like Jest.
The creator of React Testing Library explains common mistakes developers make and provides advice on how to write better tests.
A guide to using different function forms in JavaScript and React, including personal rules for function declarations, expressions, and arrow functions.
A beginner's guide to learning React by starting with the simplest possible setup using vanilla JavaScript and an HTML file.
Explains the State Reducer pattern for React Hooks, enabling inversion of control for component state management.
Explains why client-side redirects are bad for performance and recommends using server-side redirects instead.
A guide on testing custom React hooks, using a useUndo hook as a practical example to demonstrate effective testing strategies.
A comparison of React's useState and useReducer hooks, explaining their trade-offs and when to use each through practical examples.
Explains why using multiple boolean states like isLoading can lead to UI bugs and advocates for using a single status enum instead.
A guide on using React's Profiler API to monitor and track component render performance in production applications.
Explains why and how to replace the axios HTTP library with a lightweight, custom wrapper around the browser's native fetch API.
A guide to fixing the 'not wrapped in act(...)' warning in React component tests, covering class and function components.