且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法使用react和redux在组件中显示数据

更新时间:2023-01-16 14:33:37

您没有返回 JSX 地图函数内的内容。

You are not returning the JSX content inside your map function.

 renderUser(user) {
    return (           // Added a return statement here
    <div className={ styles.card }> 
      <h4>{ user.name }</h4>
      <p>Lego Inc</p>
      <a>Email</a>
    </div>
    )
  }

此外,您还需要使用console.log( $ {userList} ), console.log(userList)会工作,但与问题无关。只想添加答案

Also you need to use console.log(${userList}) is not required, console.log(userList) will work, however that not relevant to the problem. Just wanted to add to the answer