Home > database >  How can I get multiple random images from unsplash to appear on my site?
How can I get multiple random images from unsplash to appear on my site?

Time:03-31

I am currently working on a react page that uses a collection of images from unsplash. I've used an <img src="https://source.unsplash.com/random/?Cryptocurrency/" alt="crypto"/> tag to display the images for each content on the page. however, it displays the same image for each piece of content. I've tried looking at the documentation on the unsplash website but I'm unable to fix the problem. Any advice on where to start would be greatly appreciated.

CodePudding user response:

<img alt="crypto" src="https://source.unsplash.com/random/?Cryptocurrency&1">
<img alt="crypto" src="https://source.unsplash.com/random/?Cryptocurrency&2">

Add some random different parameter to every image as shown in my example and it works.

  • Related