Skip to content

Commit

Permalink
Updated setTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bntnam committed Apr 25, 2020
1 parent 2b9e655 commit e0bf217
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/codepen/CodePen.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export const CodePen = () => {
const [isLoading, setIsLoading] = useState(true);

useEffect(() => {
setTimeout(() => setIsLoading(false), 3000);
const timer = setTimeout(() => {
setIsLoading(false);
}, 3000);
return () => clearTimeout(timer);
}, []);

return (
Expand Down

0 comments on commit e0bf217

Please sign in to comment.