Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Basics (retired) Designing Data Flow Adding Players to the Scoreboard

Brian Foley
Brian Foley
8,440 Points

input field doesn't work

I'm hoping someone can spot for me why I can't type a name into my scoreboard. The error message in the console isn't really helpful. Any help is much appreciated!

Here's a link to my workspace: https://w.trhou.se/o19eej0cx2

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

Starting line 41 you have:

  onNameChange: function(e) {

    this.setState({name: e.target.value});   // Usual boilerplate to tie form input to virtual DOM
    this.setState({name: ""});  // Then you immediately clear it
  }, 
Brian Foley
Brian Foley
8,440 Points

Thank you very much!