Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to display image in react js component

// METHOD 1
import logo from './logo.jpeg';
<img src={logo} />
  
// Method 2
const logo = require('./logo.jpeg'); 
<img src={logo.default} />
  
// Method 3
<img src={require('./logo.jpeg').default} />
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #display #image #react #js #component
ADD COMMENT
Topic
Name
4+9 =