Components Section 8 - Updating the State

I’m following your React course that I purchased, but there is a problem.

  1. In the Components section,
  2. In #8 Updating the State,
  3. You said to put ‘counter’ in the value

I did that in my code, but I get an error that ‘value’ is undefined.

How do I debug this?

The next section builds on this part, so I cannot move forward.

Here is my code:

Here is the error, as shown in my Chrome browser:

the value should be initialized to 0 (zero)

check it here

1 Like

Setting the value to 0 (zero) does work, but the tutorial video was showing how to pass the counter in the props.

My first post here showed 3 circles to show 1. What Section, 2. What Chapter, and 3. The Code from the video. Those are all from a screenshot of the video at time 4.29.

Is the video incorrect?


You can compare with a version I did.

Code @GitHub

I do not remember the code being wrong in that part.
However I might have used different names than in the course but it should be self explanatory.

Good luck.

1 Like

try to understand the concept single source of truth

Counter Demo

1 Like