//使用方式二:

react怎么加载图片

react中引入图片的几种方式

//方式一: import tsIcon from '../images/typescript.webp';
//方式二: const tsIcon = require( '../images/typescript.webp');
//使用方式一:<img src={tsIcon} alt= "" />
//使用方式二:<div style={{ background: `url(${tsIcon}) no-repeat`}}> </div>
//使用方式三: const styles = { test: { background: `url(${tsIcon}) no-repeat center` }}render() { return ( <div style={styles.test}></div> )}

更多相关技术文章,请访问HTML中文网

以上就是react怎么加载图片的详细内容,更多请关注易知道|edz.cc其它相关文章!

推荐阅读