Created
September 20, 2021 19:08
-
-
Save deevis/af592a2ad335cfbc5d78cbe995562f0a to your computer and use it in GitHub Desktop.
Build a histogram of React hook usage in a project
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
for effect in useState useEffect useContext useReducer useCallback useMemo useRef useImperativeHandle useLayoutEffect useDebugValue; do RESULT=`find client/src -iname "*.js" | xargs grep -s -E "import React.*use.*from" | grep $effect | wc -l`; echo "$RESULT $effect"; done | sort -n -r | |
# 166 useState | |
# 128 useEffect | |
# 23 useCallback | |
# 8 useRef | |
# 1 useReducer | |
# 1 useContext | |
# 0 useMemo | |
# 0 useLayoutEffect | |
# 0 useImperativeHandle | |
# 0 useDebugValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment