useSelector: Reading Redux State in React Components

Hands-on practice for this lecture. Write the code, see it run, understand the pattern.

1

Exercise 1 of 1

Implement useSelector

Provider is wired. Replace the hardcoded empty array with useSelector — and watch deletions automatically re-render the list.

Task

Provider is in place. Open Tasks.js and replace the hardcoded [] with a useSelector call.

The store state in this app is the task array itself (not nested). Your selector: (state) => state. Once correct, the three initial tasks appear. Delete one — useSelector triggers a re-render automatically.

Loading editor…
Practice: useSelector: Reading Redux State in React Components — Interactive Exercises | Durgesh Rai