Search
 
SCRIPT & CODE EXAMPLE
 

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} />
Comment

image view component react js

import { PhotoProvider, PhotoView } from 'react-photo-view';
import 'react-photo-view/dist/react-photo-view.css';

export default function App() {
  return (
    <PhotoProvider>
      <PhotoView src="/1.jpg">
        <img src="/1-thumbnail.jpg" alt="" />
      </PhotoView>
    </PhotoProvider>
  );
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery select input with empty value 
Javascript :: how to add eslint to react project 
Javascript :: accept 2 values after decimal in angular forms 
Javascript :: adjust color of text js javascript 
Javascript :: index of row jquery 
Javascript :: discord buttons 
Javascript :: react pass variable from child to parent 
Javascript :: javascript foreach loop 
Javascript :: node.js anonymous function 
Javascript :: javascript get page args 
Javascript :: new Date().now 
Javascript :: isfunction javascript 
Javascript :: javascript mod 
Javascript :: nuxt add plugin 
Javascript :: how to import json in js 
Javascript :: deprecationwarning: mongoose 
Javascript :: datatables cdn 
Javascript :: how to pass custom regex in jquery validation 
Javascript :: js mysql date format and dmy format 
Javascript :: latitude longitude to km javascript 
Javascript :: async function js 
Javascript :: async wait for axios reactjs 
Javascript :: Javascript add leading zeroes to date 
Javascript :: find average of numbers 
Javascript :: react increment multipying button click 
Javascript :: csv upload with react 
Javascript :: add days to date javascript dd/mm/yyyy in input date 
Javascript :: set cors for a react node application socket error 
Javascript :: javascript non-repeating randomize array 
Javascript :: react history listen get previous location 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =