react-useStateRef
react-useStateRef copied to clipboard
Export types
Having access the the types without hoop jumping is useful.
Zero logic changes, nothing new, just exporting some existing types.
import useStateRef, {ReadOnlyRefObject} from 'react-usestateref';
const SomeComponent = () => {
const [year, setYear, yearRef] = useStateRef<number>(undefined);
const doSomething = (ref: ReadOnlyRefObject<number>) => {
// doing something with ref.current
}
doSomething(yearRef);
// etc
}