Assigning prop value to local let in function, undefined

In my console, I can see that z is undefined. I don’t understand why it’s not reflecting the prop value assigned to it. I initialize z so why is it undefined?

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      sessionCount: 25,
      breakCount: 5
    };
  }  

  // Updates session and break count prop
  // string, string => void
  updateCount(x, y) {
    let z = 0;
    
    // update sessionCount
    if (x === "session") {
      z = this.sessionCount;  // TODO ISSUE not being assigned value
      console.log("z: " + z);

Console: z: undefined

There’s more code that does not affect this issue (ie. the if statements have finishing curly brackets, render() is fine, etc).

CodePen: codepen link

Remember, you are extracting value from state. so it should be

z = this.state.sessionCount

Ah, thank you!

Post requires 20 chars so… :grinning: