N
N
NazarJs2019-11-24 17:24:13
typescript
NazarJs, 2019-11-24 17:24:13

How to fix error when running React + Typescript?

I tried to rewrite my code from React to React + Typescript. How to fix error when running React + Typescript ?
5dda938d0a397106187149.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Robur, 2019-11-25
@Robur

you need to add the cartItems property to the state description.
most likely in the myState interface:

interface myState {
cartItems: ItemType[]|
}

ItemType of course you need to substitute the correct one

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question