Why is my code returning NaN

I am getting undefined

give me the newest link to your current code

The log should be in handlePow try that instead

That’s the correct thing to be logging just change it to the pow handler

You will also need to give the pow input a number to see it logged

* undefined

Warning: A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
at input
at label
at form
at div
at App (https://pow-find.stackblitz.io/~/src/App.js:11:9)
handlePow(event) {
    console.log(event.target.value)
    this.setState({pow: event.target.pow});
  }

is this what you are doing

handlePow(event) {
    this.setState({pow: event.target.pow});
    console.log(event.target.value)
  }

Its not logging because its hitting your line of code first and throwing an error, switch them around

1 Like

got the number i entered!

That’s great! so now set pow to that value

1 Like

Thanks! that helped @caryaharper

1 Like

Finished!

1 Like

Thanks once again @caryaharper :grinning:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.