Horje
how to import images from public folder in react js Code Example
import all images from folder reactjs
function importAll(r) {
  let images = {};
  r.keys().map((item, index) => { images[item.replace('./', '')] = r(item); });
  return images;
}

const images = importAll(require.context('./images', false, /\.(png|jpe?g|svg)$/));

<img src={images['doggy.png']} />
how to import images from public folder in react js
const images = importAll(require.context('./images', false, /\.(png|jpe?g|svg)$/));

<img src={images['doggy.png']} />




Javascript

Related
7.7.backslash, \ Code Example 7.7.backslash, \ Code Example
How to check if an item is selected from an HTML drop down list with javascript js Code Example How to check if an item is selected from an HTML drop down list with javascript js Code Example
** in javascript Code Example ** in javascript Code Example
how to get current date in express js Code Example how to get current date in express js Code Example
remove div by class name javascript Code Example remove div by class name javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10