react-user-media
react-user-media copied to clipboard
return object from hook should be memoized
useMemo on https://github.com/vardius/react-user-media/blob/c5acaae23a804887fdbde8de5ed8cc9cad7e5727/src/useUserMedia.tsx#L53-L56 so you can use the object like:
const media = useUserMedia()
useEffect(() => {
}, [media]) // media is stable, since it's memoized
Thanks @pocesar, for pointing this out, Do you want to create a pull request ?
Why not memoize when necessary? At the upper scope:
const media = React.useMemo(useUserMedia, [])