gpt4 book ai didi

reactjs - 类型 '{ src: String; }' 不可分配给类型 'SVGProps

转载 作者:行者123 更新时间:2023-12-04 16:41:44 29 4
gpt4 key购买 nike

当我做这样的事情时,我收到以下错误

import React from 'react'
import "./../../styles/container.scss"
import './../../styles/common.scss'

interface containerProps {
icon: String,
heading: String,
para: String,
}


export const IconRowContainer = ({heading, para, icon}: containerProps) => {
return (
<div className="icon-row-container-main-div">
<image src={icon} />
<div>
<h2 className="secondary-heading icon-row-container-heading"> {heading} </h2>
<p className="para icon-row-container-para"> {para}</p>
</div>
</div>
)
}

错误

Type '{ src: String; }' is not assignable to type 'SVGProps'. Property 'src' does not exist on type 'SVGProps'



知道我在这里做错了什么吗?

最佳答案

使用 <img src={icon} />而不是 <image src={icon} />

关于reactjs - 类型 '{ src: String; }' 不可分配给类型 'SVGProps<SVGImageElement>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59455464/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com