I've not used it but I've just had a look at the code. useMediaPredicate() doesn't update itself, which maybe you would want but it's not something I've added to this one too. useMedia() does the same as this one, without an option to change the query, but uses react useCallback so will use a tiny bit more memory but that's alright.
There's nothing wrong with using something someone else has written but it's good to understand how things work because one day they'll be a hook you need that no-one has made yet. 😅
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I like the tutorial, I'm already using the react-media-hook and it's useMediaPredicate() hook. Have you used that one?
I've not used it but I've just had a look at the code.
useMediaPredicate()
doesn't update itself, which maybe you would want but it's not something I've added to this one too.useMedia()
does the same as this one, without an option to change the query, but uses reactuseCallback
so will use a tiny bit more memory but that's alright.There's nothing wrong with using something someone else has written but it's good to understand how things work because one day they'll be a hook you need that no-one has made yet. 😅