reactjs - React Component Image Issue -
my image component won't seem put image in, url correct can add physically adding html page. component seems failing. tried found @ http://facebook.github.io/react/docs/jsx-in-depth.html#attribute-expressions did not help.
export default class mainlogo extends react.component { render() { return ( <div> <img src = {'/src/app/assets/images/home/mainlogo.png'}/> </div> ); } }
the class name should start capital letter (mainlogo) , shouldn't use {} on src, because sending img url directly src. it's not variable or state.
this should work:
export default class mainlogo extends react.component { render() { return ( <div> <img src='/src/app/assets/images/home/mainlogo.png' /> </div> ); } }
Comments
Post a Comment