" tag, but the path to the image cannot be directly written in the srcs attribute of the tag. It can be introduced in the form of "" picture."/> " tag, but the path to the image cannot be directly written in the srcs attribute of the tag. It can be introduced in the form of "" picture.">
Home > Article > Web Front-end > What tags are used for images in react
In react, images use the "a1f02c36ba31691bcfe87b2722de723b" tag, but the path to the image cannot be written directly in the srcs attribute of the tag. You can use "d3891d8c5de441245b6f00b1304f7f5f" to introduce images.
The operating environment of this tutorial: windows7 system, react16 version. This method is suitable for all brands of computers.
Recommended related tutorials: React video tutorial
The tags used for images in React are the same as those in HTML, which is the a1f02c36ba31691bcfe87b2722de723b tag, which defines the image in the web.
But es6 does not support writing the path of the image directly in the a1f02c36ba31691bcfe87b2722de723b
tag, that is, it cannot be used like this 5a8cca8a9993efcacfe4f9d3ff141824
So how to introduce images into react? Solution:
Introducing images into react, methods that can be used:
1) Recommended use: require method. It should be noted that with this method, only strings can be written in require. , cannot write variables.
<img src={require('图片url')} />
2) Import method:
import imgURL from '图片url'; <img src={imgURL } />
For more programming-related knowledge, please visit: Programming Teaching! !
The above is the detailed content of What tags are used for images in react. For more information, please follow other related articles on the PHP Chinese website!