Ankit Arora
Ankit Arora

Reputation: 11

Display image in reactjs when the image name is stored in local storage

I have stored the image name in local storage. The question is how to display image in reactjs.

Upvotes: 0

Views: 312

Answers (1)

Saad Awan
Saad Awan

Reputation: 96

const url = localStorage.getItem('imageName')

<img className="attached_image" src={url} alt="my upload" />

Get your image name from local storage and save its value in a variable which you can use next in img tag.

Hope this helps.

Upvotes: 2

Related Questions