[英]A React component is getting rendered but not showing on the website
A react component is not showing up on the webpage even though it is getting rendered.即使正在呈现反应组件,它也不会显示在网页上。
I have attached the code and screenshot of the components below.我附上了下面组件的代码和屏幕截图。
This is the code inside "App.jsx" file.这是“App.jsx”文件中的代码。
function createCard(prop){
return (<Card key={prop.id} name={prop.name} emoji={prop.emoji} desc={prop.meaning}
/>);
}
function App(){
return(
<div>
<h1>
<span>emojipedia</span>
</h1>
{emojipedia.map(createCard)}
</div>
);
}
This is the code inside "Card.jsx" file.这是“Card.jsx”文件中的代码。
<div>
<dl className="dictionary">
<div className="term">
<dt>
<Name name="props.name" />
<Emoji emoji="props.emoji"/>
</dt>
<Description desc="props.desc" />
</div>
</dl>
</div>
In the code above, <Description desc="props.desc /> is getting rendered but not showing up on the webpage.在上面的代码中, <Description desc="props.desc />正在呈现但未显示在网页上。
You have a typo in the props.你的道具有错别字。 Change it from desp to desc then it should work.将其从 desp 更改为 desc 然后它应该可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.