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
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