K
K
kirillleogky2020-06-25 21:21:25
React
kirillleogky, 2020-06-25 21:21:25

How to include image in Create React App?

How to include an image (Cross-Icon.svg) in public/index.html when working with create-react-app, which is located in this path?
Important: I do not want to throw the image into the public folder.
5ef4eb233923b957743847.png

What to write here:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <title>React App</title>
  </head>
  <body>
    <img src="??????????????????" alt="TEXT">
    <div id="root"></div>
  </body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Karo, 2020-06-26
@Zraza

We put the picture in the public folder and write the path to the picture%PUBLIC_URL%/name-of-your-image.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question