Course contentsShow
← React
Lesson 69 of 2,3962. Setup and Modern ToolingFree lesson

Editing Props and State Live

Modify component props and state values directly in DevTools to test different scenarios without changing code.

Editing Props and State Live

What you'll learn: How to change a component's props and state directly in React DevTools to test different scenarios instantly, without touching your code.

The Magic Testing Shortcut

You've learned to inspect the component tree in DevTools. Now here's the superpower: you can edit values live while your app is running. Click on any component in the Components tab, and you'll see its current props and state in the right panel. Those values aren't just for reading—they're interactive.

How It Works

When you see a prop or state value, click it. DevTools will let you type a new value directly. The moment you press Enter, React re-renders that component (and its children) with your new value. Your code file stays untouched—this is all happening in memory, in the browser.

Why this matters: Imagine testing how your button looks when the isLoading state is true. Normally, you'd need to trigger that state through your app (clicking, waiting, etc.). With live editing, you just click the false value in DevTools, change it to true, and instantly see the loading state. No code changes, no reloading.

The Analogy

Think of it like using sliders and toggles in a photo editor's preview mode. You're not saving changes to the file—you're just experimenting to see what looks good. Same here: you're experimenting with component states without committing to code.

This is invaluable for testing edge cases, unusual prop combinations, or visual states that are hard to trigger naturally.

Key Takeaway: React DevTools lets you edit props and state values live in the browser, allowing instant experimentation and testing without modifying your source code.