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

How to quote images in react

coldplay.xixi
coldplay.xixiOriginal
2020-11-19 17:59:354175browse

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

How to quote images in react

How to reference images in react:

The usual method is

<img src="路径"></img>

but in This will report an error in React

The correct method should be

Use the require method

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

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!

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