Javascript 无法读取属性';地图';未定义的类型(ReactJS和AJAX)

Javascript 无法读取属性';地图';未定义的类型(ReactJS和AJAX),javascript,arrays,ajax,reactjs,Javascript,Arrays,Ajax,Reactjs,尝试在我的数组表中显示。数组从实际的AJAX请求中获取。我在用Redux class IncomeProfile extends Component { constructor(props) { super(props) } componentDidMount() { this.props.IncomeListProfile(); } render() { var elems = this.props.items.course_list

尝试在我的数组表中显示。数组从实际的AJAX请求中获取。我在用Redux

class IncomeProfile extends Component {
  constructor(props) {
    super(props)
  }

  componentDidMount() {
    this.props.IncomeListProfile();
      }

render() {
        var elems = this.props.items.course_list;
      console.log(elems);
        return (
          <div>
            <table>
              {elems.map((item) => (

              <tr key={item.course_id}>
                <td>{item.name}</td>
              </tr>

              ))}
            </table>
          </div>
        )
      }

}

const mapDispatchToProps = function(dispatch) {
  return {
      IncomeListProfile: () => dispatch(IncomeProfileList())
      }
  }

const mapStateToProps = function(state) {
  var mystore = state.toArray();
  //console.log(mystore[6]);
  return {
     items: mystore[6]
        };

}
export default connect(mapStateToProps, mapDispatchToProps)(IncomeProfile);
class IncomeProfile扩展组件{
建造师(道具){
超级(道具)
}
componentDidMount(){
this.props.IncomeListProfile();
}
render(){
var elems=this.props.items.course\u列表;
控制台日志(elems);
返回(
{elems.map((项目)=>(
{item.name}
))}
)
}
}
const mapDispatchToProps=功能(调度){
返回{
IncomeListProfile:()=>dispatch(IncomeProfileList())
}
}
const mapStateToProps=函数(状态){
var mystore=state.toArray();
//console.log(mystore[6]);
返回{
物品:mystore[6]
};
}
导出默认连接(mapStateToProps、mapDispatchToProps)(IncomeProfile);
Console.log首先打印“未定义”,然后打印:


如果(元素){}没有帮助,请尝试在渲染方法
中添加条件使用以下内容

var elems = this.props.items['course_list'];
 var copy = Object.assign({}, elems); 
 console.log(elems.course_list);

错误消息表示运行时未定义
elems
。希望这有助于调试。