mhaagens / react-mobx-react-router4-boilerplate

React, React-Router 4, MobX and Webpack 2-boilerplate with async routes.
560 stars 137 forks source link

display images #46

Closed strowbeary closed 7 years ago

strowbeary commented 7 years ago

Hello, I would like to diplay images with a component <Image name="logo.svg"/> and i don't know wich path i can use. How to load images with their paths/names ?

Thank you

mhaagens commented 7 years ago

If you want to load it inside your component you need to require the image file like this (relative to the directory of your component);

const myImage = require("../images/myimage.png");

Then you can use it like this;

<img src={myImage} />