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

How to quote images in react

coldplay.xixi
Release: 2020-11-19 17:59:35
Original
4162 people have browsed it

How to reference images in react: First open the code editor; then use the require method to introduce it, the code is [].

How to quote images in react

How to reference images in react:

The usual method is

<img src="路径"></img>
Copy after login

but in This will report an error in React

The correct method should be

Use the require method

<img src={require( “路径”)}></img>
Copy after login

Related learning recommendations: javascript learning tutorial

The above is the detailed content of How to quote 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