npm install
npm start
npm run build
This is my own approach, and it may still has some layout problem because of the debounced compute method.
But this approach is better than doing nothing.
And once the images are all loaded or the Masonry component is remounted(when all pics are cached), it works fine.
hope it helps :)