Performantly pass window dimensions as props! ๐
import * as React from 'react';
import { WindowSize } from 'react-window-bigness';
const MyComponent = () => (
<WindowSize>
{({ windowWidth, windowHeight }) => JSON.stringify({ windowWidth, windowHeight })}
</WindowSize>
);
export default MyComponent;
import * as React from 'react';
import { withWindowSize } from 'react-window-bigness';
const MyComponent = ({ windowWidth, windowHeight }) => (
JSON.stringify({ windowWidth, windowHeight })
);
export default withWindowSize(MyComponent);