bloczjs / react-responsive

🔍 <Only /> displays some contents for particular screen sizes
22 stars 0 forks source link

Use breakpoint support array #63

Open Ayc0 opened 1 year ago

Ayc0 commented 1 year ago

At the moment, we can do useBreakpoint('md lg'). Instead we should support useBreakpoint(['md', 'lg']) It would be a bit more performant as we wouldn't have to do the split every time

The issue with using an array is that it'd bust the react cache at each re-render when used in an inline way

https://github.com/bloczjs/react-responsive/blob/c6249332483d9b53bdf17cb8bd3072765a91002e/packages/react-responsive/src/useBreakpoint.ts#L13