Javascript 道具中的问题;无法读取属性';地图';“未定义”的定义;

Javascript 道具中的问题;无法读取属性';地图';“未定义”的定义;,javascript,reactjs,react-props,Javascript,Reactjs,React Props,我是新来的。我在将包含对象的数组作为道具从一个组件传递到另一个组件时遇到问题。你们能帮我一下吗 这是我作为道具传递值的卡信息组件的代码 const CardsInformation=()=>{ 常数Baba=[ { id:'b1', 标题:“书籍1名称”, 图像:'https://www.google.com/search?q=engineering+books&rlz=1chbf_enni862in862&sxsrf=alekkk01jlmecor-2vd0ev6raozsaqmadg:15

我是新来的。我在将包含对象的数组作为道具从一个组件传递到另一个组件时遇到问题。你们能帮我一下吗

这是我作为道具传递值的卡信息组件的代码

const CardsInformation=()=>{
常数Baba=[
{
id:'b1',
标题:“书籍1名称”,
图像:'https://www.google.com/search?q=engineering+books&rlz=1chbf_enni862in862&sxsrf=alekkk01jlmecor-2vd0ev6raozsaqmadg:1589729471894&source=lnms&tbm=isch&sa=X&ved=2hukewjo9dfjm7vpahv8yjgghr-zdcoqw&biw=1536&bih=763#imgrc=OzVmsuZIvusEJM',
描述:“本书超越了拍板的简单功能,向您介绍了许多产品,这些产品可以用于控制照明水平、浇灌草坪、关闭窗帘以及管理家中的各种电器。”,
}
];
返回(
)
}
从“react dom”导入react dom;
从“React”导入React;
常量应用=()=>{
常数Baba=[
{
id:“b1”,
标题:“第一册名称”,
图片:
"https://www.google.com/search?q=engineering+books&rlz=1chbf_enni862in862&sxsrf=alekkk01jlmecor-2vd0ev6raozsaqmadg:1589729471894&source=lnms&tbm=isch&sa=X&ved=2hukewjo9dfjm7vpahv8yjgghr-zdcoqw&biw=1536&bih=763&imgrc=OzVmsuZIvusEJM“,
描述:
本书超越了拍板器的简单功能,向您介绍了许多产品,这些产品可用于控制照明水平、浇灌草坪、关闭窗帘以及管理家中的各种电器
}
];
返回(
);
};
常量卡片标签=({book})=>{
returnbook.map(用户=>{
返回{user.header};
});
};
render(,document.getElementById(“根”));

为什么投反对票。这段代码绝对工作正常,解决了我没有解决的错误。但我认为有人这样做是因为它只是代码。如果它解决了你的问题。请投票并接受我的答案。假设我修复了Card_tabs,那么代码工作正常:(同时记录:我认为链接的副本并没有特别的帮助;显示的代码是错误的,但很明显,
props.book
永远不会被取消定义,因为它是一个数组常量)
import ReactDOM from "react-dom";
import React from "react";

const App = () => {
  const Baba = [
    {
      id: "b1",
      header: "Book 1 Name",
      image:
        "https://www.google.com/search?q=engineering+books&rlz=1C1CHBF_enIN862IN862&sxsrf=ALeKk01jlMEcOr-2Vd0ev6RaoZZSAqMADg:1589729471894&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjO9dfjm7vpAhV8yjgGHR-zDCoQ_AUoAXoECBMQAw&biw=1536&bih=763#imgrc=OzVmsuZIvusEJM",
      discription:
        "This book steps beyond the simple functions of the Clapper, introducing you to a number of products that can be used for everything from controlling lighting levels, watering your lawn, closing your drapes, and managing sundry appliances in your home."
    }
  ];

  return (
    <div>
      <CardTabs book={Baba} />
    </div>
  );
};

const CardTabs = ({ book }) => {
  return book.map(user => {
    return <h1>{user.header}</h1>;
  });
};

ReactDOM.render(<App />, document.getElementById("root"));