importfrom”react”importfrom”react-cool-dimensions”const() =>constconst// The “currentBreakpoint” will be the object key based on the target’s width// for instance, 0px – 319px (currentBreakpoint = XS), 320px – 479px (currentBreakpoint = SM) and so onXS0SM320MD480LG640onResize( { currentBreakpoint } ) =>// Now the event callback will be triggered when breakpoint is changed// we can also access the “currentBreakpoint” herereturn< div class = { ` card ${ currentBreakpoint }`} ref = {ref} >

Comments to: React Hook to Measure an Element’s Size and Handle Responsive Components

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

Login

Welcome to Typer

Brief and amiable onboarding is the first thing a new user sees in the theme.
Join Typer
Registration is closed.