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} />
 
PREVIOUS NEXT
Tagged: #display #image #react #js #component
ADD COMMENT
Topic
Name
1+9 =