Closed hiradary closed 3 years ago
You could use the matchmediaquery
module directly (import matchMedia from 'matchmediaquery'
) and just not listen to updates - plus you can optionally use that with our toQuery
method (which turns our nice objects into text media queries) that is exported from our root https://github.com/contra/react-responsive/blob/master/src/index.js#L9
Just make sure if you use matchMedia directly you immediately dispose of the query after you get the results since it will use some resources if you never dispose it!
It's not an issue but I guess It'd have been better if we had an option to just get the initial
useMediaQuery
response, not changing on resize.@contra You mentioned something here: https://github.com/contra/react-responsive/issues/240#issuecomment-562621411
I'm wondering if we can ignore the further changes and just go on with the initial render.