-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
It's not recommended to use document when you are using React.
Where do you have this issue?
src/pages/PostForm.js- Check if it is in other files
As an alternative
You can create a state using useState to save the image metadata, such as src or alt, and update the data using the setter.
Example
setImagePreview(prev => { ...prev, url: imageUrl });You just have to use that state in the src of the image, like this:
<img src={imagePreview.src} alt={imagePreview.alt} />There are more alternatives that I invite you to investigate and use the one you consider most convenient.
Metadata
Metadata
Assignees
Labels
No labels