import { useRef, useLayoutEffect } from 'react'; /** * A custom hook that handles focus on a DOM element. * Takes in a boolean value and calls element.focus * * @param {boolean} focus * * Example usage: ******************************************************************************* * const SearchBar = ({ focus }) => { * const ref = useFocus(focus); * return * } ******************************************************************************* * const ItemList = ({ items, focus }) => ( *