Home > Article > Web Front-end > How to introduce images in react
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.
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)
#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
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!