Skip to content

Commit 44a428f

Browse files
committed
Fix code
1 parent a518342 commit 44a428f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/App.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ function App() {
1111
//increase points every second
1212
setPoints(points + pointsPerSecond);
1313
}, 1000);
14-
return () => clearInterval(interval); //clear interval when component unmounts
15-
});
14+
return () => {
15+
clearInterval(interval); //clear interval when component unmounts
16+
};
17+
}, []);
1618
function addPointsFromClick() {
1719
//add points from clicking a button
1820
setPoints(points + clickMultiplier); //increase points by 1 when button clicked

0 commit comments

Comments
 (0)