Reputation: 81
I have a images files but react is not take them ı cant import like that. Otherwise when i try
<img src={require("/FileAdress")} className="Logo" alt="logo" /> Nothings came and not recognized
whats the problem anyone help ?
I have a logo folder inside image logo.png but ı cant see now
Upvotes: 1
Views: 662
Reputation: 39
IF you are planning to deploy your react app later on with Netlify I would suggest you store your images in the public folder. That way then they can be easily accessed during development but they would also not cause any errors later on when deployment.
Example code:
<img
className='deleteBtn'
**src='/images/delete__btn.png'**
alt='Delete a product if admin'
/>
Example snapshot
Upvotes: 0
Reputation: 13078
If you are using create-react-app
you can add an image this way:
import Logo from 'path/to/logo.png';
<img src={Logo} className="Logo" alt="logo" />
Upvotes: 0