Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Improved formatting
Source Link
Cristik
  • 33.2k
  • 26
  • 106
  • 143

You need to take care of the following:

  1. event handlers need to be mapped to a function:

    <button onClick={this.onChallengeButtonClicked}>Start<button>

  2. You need to tell each button to which item it corresponds to:

    <button item={item} onClick={this.onChallengeButtonClicked}>Start<button>

  3. Event handler function can detect which button item was clicked by accessing the event parameter: onChallengeButtonClicked: function(event) { item = event.currentTarget.item; window.location.href = item.title; }

    event handlers need to be mapped to a function:
<button onClick={this.onChallengeButtonClicked}>Start</button> 
  1. You need to tell each button to which item it corresponds to:
<button item={item} onClick={this.onChallengeButtonClicked}>Start</button> 
  1. Event handler function can detect which button item was clicked by accessing the event parameter:
onChallengeButtonClicked: function(event) { item = event.currentTarget.item; window.location.href = item.title; } 

You need to take care of the following:

  1. event handlers need to be mapped to a function:

    <button onClick={this.onChallengeButtonClicked}>Start<button>

  2. You need to tell each button to which item it corresponds to:

    <button item={item} onClick={this.onChallengeButtonClicked}>Start<button>

  3. Event handler function can detect which button item was clicked by accessing the event parameter: onChallengeButtonClicked: function(event) { item = event.currentTarget.item; window.location.href = item.title; }

You need to take care of the following:

  1. event handlers need to be mapped to a function:
<button onClick={this.onChallengeButtonClicked}>Start</button> 
  1. You need to tell each button to which item it corresponds to:
<button item={item} onClick={this.onChallengeButtonClicked}>Start</button> 
  1. Event handler function can detect which button item was clicked by accessing the event parameter:
onChallengeButtonClicked: function(event) { item = event.currentTarget.item; window.location.href = item.title; } 
Source Link
Cristik
  • 33.2k
  • 26
  • 106
  • 143

You need to take care of the following:

  1. event handlers need to be mapped to a function:

    <button onClick={this.onChallengeButtonClicked}>Start<button>

  2. You need to tell each button to which item it corresponds to:

    <button item={item} onClick={this.onChallengeButtonClicked}>Start<button>

  3. Event handler function can detect which button item was clicked by accessing the event parameter: onChallengeButtonClicked: function(event) { item = event.currentTarget.item; window.location.href = item.title; }