FaCC that works similar to <SizeSensor>
but re-renders only on width change.
Use it as FaCC
import {WidthSensor} from 'libreact/lib/WidthSensor';
<WidthSensor>{({width, height}) =>
`WIDTH: ${width}, HEIGHT: ${height}`
}</WidthSensor>
Or use onWidth
prop
import {WidthSensor} from 'libreact/lib/WidthSensor';
<SizeSensor onWidth={({width, height}) => console.log(width, height)}>
Resize me!
</SizeSensor>
Works same as withSize()
and @withSize
.
Incldue withWidth
as follows
import {withWidth} from 'libreact/lib/WidthSensor';