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

How to introduce images in react

王林
Release: 2020-12-22 16:40:36
Original
3568 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template