开云出任那不勒斯官方合作伙伴

3年前 (2023-05-23)

您正在执行此操作,import PostList from '../components/PostList';因此需要export default在PostList.js文件中使用。 同题参见

否则,您需要做import { PostList } from '../components/PostList';对照阅读

对于感兴趣的人,这是一篇有关es6导入/导出语法的不错的文章:http ://www.2ality.com/2014/09/es6-modules- final.html 相关阅读

下面的代码给出

未捕获的错误:您必须将组件传递给connect返回的函数。而是收到未定义

List.js

import React from 'react';
import { connect,bindActionCreators } from 'react-redux';
import PostList from '../components/PostList'; // Component I wish to wrap with actions and state
import postList from '../Actions/PostList' //Action Creator defined by me

const mapStateToProps = (state,ownProps) => {
 return state.postsList
}

const mapDispatchToProps = (dispatch) => {
 return bindActionCreators({"postsList":postList},dispatch)
}

export default connect(mapStateToProps,mapDispatchToProps)(PostList);

PostList.js

import React from 'react'

export const PostList = (props) => {
 return 
List
}

请帮我解决方案?

你可能想看:

标签:const

继续阅读

若需了解「开云出任那不勒斯官方合作伙伴」的上下文,可结合站内栏目与相关篇目交叉阅读。

栏目用于追新,文内链接用于对照细节。两者配合可减少漏读与重复检索。

继续浏览时优先选择同栏目或相近主题,避免被站外镜像带偏。

站点导览

const · wiki · 科技 · 文化

页面按栏目组织。可先看导读,再进入相关篇目或返回列表。