Use React to Display Images in a Grid Like Google and Flickr

John Au-Yeung
Level Up Coding
Published in
8 min readSep 17, 2019

--

If you use image search websites like Google Image Search or Flickr, you will notice that their images display in a grid that looks like a wall of bricks. The images are uneven in height, but equal in width. This is called the masonry effect because it looks like a wall of bricks.

To implement the masonry effect, we have to set the width of the image proportional to the screen width and set the image height to be proportional to the aspect ratio of the image.

--

--