-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debounce-5: abstracted simple debounced navigation out to a hook (#296)
* tried debouncing drill list * debounced leaderboard, assigning drills, and users on team * debounced some more buttons * handled debouncing user info update button * handled wacky submit btn * WIP on frankreed/debounce-2-teams-page * removed typescript dependency * some work * added back typescript lmao * moved typescript to devDependency * forgot button countdown works. Technically not debouncing but in the same veins * pretty * handled timeIntervalPassword is NaN * abstracted simple debounced navigation out to a hook * decrease reset cooldown time to 30s Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com> --------- Co-authored-by: Jake Gehrke <91503842+Gehrkej@users.noreply.github.com>
- Loading branch information
1 parent
d5962cf
commit 437d6c6
Showing
4 changed files
with
28 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { router } from "expo-router"; | ||
import { useCallback } from "react"; | ||
import { debounce } from "underscore"; | ||
|
||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
export const useDebouncedNavigation = () => | ||
useCallback( | ||
debounce( | ||
(href) => { | ||
router.push(href); | ||
}, | ||
1000, | ||
true, | ||
), | ||
[], | ||
); |