Đoạn code dưới đây mang đến choBạn phải chuyển một thành phần vào hàm được trả về bằng kết nối. Thay vì nhận được xác định
Uncaught Error: You must pass a component to the function returned by connect. Instead received undefined
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 <div>List</div>
}
Xin hãy giúp tôi với một giải pháp?
séc Postlist nhập khẩu –
Không có vấn đề với PostList nhập khẩu –
Bạn có chắc chắn bạn không phải một trong hai mặc định xuất khẩu hoặc nhập {PostList} từ '../components/PostList'; – noveyak