Poniższy kod dajeMusisz przekazać komponent do funkcji zwróconej przez connect. Zamiast tego otrzymał niezdefiniowany
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>
}
Proszę mi pomóc w rozwiązaniu?
check Postlist import –
Nie ma problemu z PostList importu –
Czy jesteś pewien, że nie trzeba ani domyślnie wywóz lub importuj {PostList} z "../components/PostList"; – noveyak