Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
List 反应-列出道具没有的项目';t传递到渲染列表组件_List_Reactjs_Components_Listitem - Fatal编程技术网

List 反应-列出道具没有的项目';t传递到渲染列表组件

List 反应-列出道具没有的项目';t传递到渲染列表组件,list,reactjs,components,listitem,List,Reactjs,Components,Listitem,我是React Js的新手,我尝试制作一个列表组件来注入不同的ListItems。 但是当物品通过时,道具不会通过。 出了什么问题 2017年12月更新 const List=(道具)=>{ const componentorender=props.component; 让内容=(); if(道具项目){ 内容=道具.项目.地图((项目,索引)=>( )); }否则{ 内容=(); } 返回( {content} ); } 常量列表项=(道具)=>( ); 常数el=[ {href:“

我是React Js的新手,我尝试制作一个列表组件来注入不同的ListItems。 但是当物品通过时,道具不会通过。 出了什么问题

2017年12月更新

const List=(道具)=>{
const componentorender=props.component;
让内容=();
if(道具项目){
内容=道具.项目.地图((项目,索引)=>(
));
}否则{
内容=();
}
返回(
    {content}
); } 常量列表项=(道具)=>(
  • ); 常数el=[ {href:“#”,图标:“fa-fa-phone”,名称:“bannana”}, {href:“#”,图标:“fa-fa-phone”,名称:“apples”} ]; ReactDOM.render( ,document.getElementById('app') );


    提前感谢我的朋友。

    您将
    项目
    拼错为
    项目

    ReactDOM.render(
    ,document.getElementById('app')
    );
    
    好的,我自己找到的 只需通过:

    <ComponentToRender key={`item-${index}`} {...item}/>
    

    Hi Ming Soon,您是否介意帮助我了解为什么道具无法通过,例如名称、图标、href。。。