[Media Queries in React] | How to pass a variable to size=full prop in <Drawer> component | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

[Media Queries in React] | How to pass a variable to size=full prop in <Drawer> component

const isMobile = useMediaQuery('(max-width:992px)'); Old Syntax: <Drawer full={isMobile}></Drawer> But acc to new changes, here: https://rsuitejs.com/components/drawer/ full is Deprecated. Use size="full" instead for Full screen So, New Syntax would be: <Drawer size='full' ></Drawer> In this case, how to pass the 'isMobile' to Drawer component?

22nd Nov 2022, 7:01 PM
Asha
Asha - avatar
1 Answer
+ 1
Someone suggested it earlier, and it worked out for me. That's why leaving it here: <Drawer size={ isMobile ? 'full' : 'sm'} ></Drawer>
23rd Nov 2022, 7:30 AM
Asha
Asha - avatar