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?
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') );
Thanks, I was wondering for a while and coudlnt figure it out...
Brian Beal5,300 Points
It's an intentional feature of the StrictMode. This only happens in development, and helps find accidental side effects put into the render phase. We only do this for components with Hooks because those are more likely to accidentally have side effects in the wrong place.