Closed kode15333 closed 2 months ago
Hello @kode15333. Sorry I did not see your PR. I just pushed a similar fix and published v2.2.2
. Could you try if the issue is fixed? Thanks
@cedricdelpoux i think SSR Issue(window not defined) is happend again.
can you reopen this pr?
Again? So it was not happening anymore? My fix is pretty similar to yours https://github.com/cedricdelpoux/react-responsive-masonry/commit/0efac6e6ee978c25d4712273cd18e7ba53be43c3
I could not merge your PR because it's conflicting now but I applied your fix. Could you test v2.3.0
? Thanks
Problem
The MasonryResponsive component accesses the window object during server-side rendering (SSR), causing errors since window is only available on the client side.
Solution
Initial State Setup: Modified useWindowWidth to set the initial state using typeof window !== "undefined" ? window.innerWidth : 0 to prevent SSR errors.