react-lineto
react-lineto copied to clipboard
Responsive mode, how to do it?
I have a problem knowing what is the best way to make it responsive.
Does anybody have an idea?
You could make a window resize hook:
React.useEffect(() => {
function handleResize() {
setDimensions({
height: window.innerHeight,
width: window.innerWidth,
});
}
// const debouncedHandleResize = debounce(handleResize, 10);
window.addEventListener('resize', handleResize);
return () => {
window.removeEventListener('resize', handleResize);
};
});
You might want to debounce it depending on your need.
This will re-render the component and therefore update its position