prevents effect from being re-ran on every render

This commit is contained in:
Cassidy 2020-05-19 19:49:15 +07:00 committed by Sean Yesmunt
parent 576cc6cffd
commit c0dd3e48a4

View file

@ -170,7 +170,7 @@ function App(props: Props) {
}; };
window.addEventListener('keydown', handleKeyPress); window.addEventListener('keydown', handleKeyPress);
return () => window.removeEventListener('keydown', handleKeyPress); return () => window.removeEventListener('keydown', handleKeyPress);
}); }, []);
useEffect(() => { useEffect(() => {
if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) { if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) {