DEV Community

Cover image for How to Load Assets in Reactjs on Mac
Papa Kow Dadson
Papa Kow Dadson

Posted on

How to Load Assets in Reactjs on Mac

Unlike loading assets in Windows where you can keep the assets folder in the src folder, accessing the image using its path

eg: /assets/logo.png

In Mac

  1. Move the assets folder into the public folder.

Image description

  1. Access image using ./assets/{image_name.png} ,replace {image_name.png} with your image name

eg: background-image: url(‘./assets/{image_name.png}’)

 <img src=’./assets/{image_name.png}’ alt=’image’ />
Enter fullscreen mode Exit fullscreen mode

Top comments (0)