Home  >  Article  >  Web Front-end  >  How to introduce images in react

How to introduce images in react

王林
王林Original
2020-11-27 10:24:013530browse

How to introduce images in react: You can introduce them through !important, such as [import avatarSmall from '../.../assets/images/person/xxxjpg'], and then directly introduce variables in img. Can.

How to introduce images in react

The operating environment of this tutorial is: windows10, react16. This method is suitable for all brands of computers.

(Learning video sharing: react video tutorial)

How to introduce images in react:

Method 1: Import through !important (recommended)

How to introduce images in react

#Then just introduce the variable directly into img. The name of this variable can be arbitrary.

Method 2: Introduction of require method

require can only write strings, not variables

How to introduce images in react

More programming For related knowledge, please visit: Programming Teaching! !

The above is the detailed content of How to introduce images in react. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn