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
import { useRef, useState, useEffect } from 'react'; | |
// Usage | |
function App() { | |
const [hoverRef, isHovered] = useHover(); | |
return ( | |
<div ref={hoverRef}> | |
{isHovered ? '😁' : '☹️'} | |
</div> |
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
import {useState, useCallback, useRef} from 'react' | |
// Hook | |
const useHover = <T extends HTMLElement>(): [ | |
(node?: T | null) => void, | |
boolean, | |
] => { | |
const [value, setValue] = useState(false) | |
// Wrap in useCallback so we can use in dependencies below |
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
#!/bin/bash | |
# Author: Tobias Preuss | |
# Version: 2015-03-26 | |
echo "Creating symbolic links in Android SDK folder" | |
echo "=============================================" | |
echo | |
if [ -z "$ANDROID_HOME" ] ; then |