JavaScript React Components Managing State and Data Flow Update State Based on a Player's Index

onClick 1 and -1 to 0.5 and -0.5 otherwise increment by 2???

In the Counter I had to change the 1 and -1 to 0.5 and -0.5 because otherwise on click the score would increment by 2. Any ideas why this happened?

1 Answer

Oliver Duran
Oliver Duran
11,565 Points

Hey Marius! i fixed that problem by removin this from the index.js file, i do not know why but it worked!

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

ReactDOM.render(
    <App />,
  document.getElementById('root')
);
John Lamontagne
John Lamontagne
3,201 Points

Thanks for this, it seems like some weird code that Treehouse has put in.