cedricdelpoux / react-responsive-masonry

React responsive masonry component built with css flexbox
https://cedricdelpoux.github.io/react-responsive-masonry/
MIT License
372 stars 38 forks source link

fix: use useLayoutEffect instead of useEffect for responsive masonry #87

Closed kacper-kruczek closed 2 years ago

kacper-kruczek commented 2 years ago

useLayoutEffect

This runs synchronously immediately after React has performed all DOM mutations. This can be useful if you need to make DOM measurements (like getting the scroll position or other styles for an element)

so i think this should be used for responsiveMasonry instead of normal useEffect, this should fix this issue

cedricdelpoux commented 2 years ago

Hi @kacper-kruczek! Sorry for the delay. I just merged your PR. I will release a new version. Thank you for your help !

cedricdelpoux commented 2 years ago

released in v2.1.6