React and TypeScript React and TypeScript

useEffect TypeScript Exercise

Check out a free preview of the full React and TypeScript course:
The "useEffect TypeScript Exercise" Lesson is part of the full, React and TypeScript course featured in this preview video. Here's what you'd learn in this lesson:

Students are instructed to use the error message given by TypeScript to correct the problem within the example's code.

Get Unlimited Access Now

Transcript from the "useEffect TypeScript Exercise" Lesson

>> So another kind of example of that, we kind of go over to the next piece is to kind of take a look at this slightly problematic piece of code and I'm gonna leave it to you for a few minutes just to kind of just read there and see if you can figure out what's going on.

[00:00:19] But TypeScript as it loads is not going to be particularly pleased with this piece of code. So spend a few minutes, look at it, and just kinda see if you can. The Code Query works, but it's not actually working the way react intends it to work in TypeScript notice that it's trying to help you.

[00:00:40] So I want you to do is kind of look at it play around with and figure out, can you read the error message and figure out like what we need to do to appease TypeScript, PS TypeScript in order to really, truly appease react.