Closed Maadtin closed 4 years ago
@Maadtin The constraints are applied on render and then listens for further changes. Can you post an example of your code?
@contra Yes sure look:
function Index() {
const [selectedType, setSelectedType] = useState('animes');
const isTabletOrDesktop = useMediaQuery({minWidth: 1000});
return (
<Content />
{isTabletOrDesktop && <Sidebar />
)
}
When I reload the page <Sidebar />
component is visible but If I resize the mediaquery applies and It disappear just as I would expect but the problem is then I reload the page above 1000px It should appear but It doesn't...
Could you make a codepen/jsfiddle/etc. that reproduces the issue?
Closing since I haven't gotten a response. Will reopen if you have a reproduction available.
How to apply on component render? only works when resizing, thanks <3