React-redux: Error: undefined is not an object(evaluating 'WrappedComponent.displayName')

Created on 1 Jun 2016  ·  3Comments  ·  Source: reduxjs/react-redux

## I don't know how to solve the bug....

This is my code:

import { connect } from 'react-redux'
import { setVisibilityFilter } from '../actions'
import { Link } from '../components/Link'

const mapStateToProps = (state, ownProps) => {
return {
active: ownProps.filter === state.visibilityFilter
}
}

const mapDispatchToProps = (dispatch, ownProps) => {
return {
onClick: () => {
dispatch(setVisibilityFilter(ownProps.filter))
}
}
}

const FilterLink = connect(
mapStateToProps,
mapDispatchToProps
)(Link)

export default FilterLink

Most helpful comment

Most likely this is the issue:

import { Link } from '../components/Link'

You are doing a _named import_.
This won’t work if Link has a _default export_.

If this is the problem, you can change the import to be the _default import_ (import Link rather than import { Link }).

All 3 comments

Please use Stack Overflow for support questions. Github Issues are for the bugs in the library not your code.

Most likely this is the issue:

import { Link } from '../components/Link'

You are doing a _named import_.
This won’t work if Link has a _default export_.

If this is the problem, you can change the import to be the _default import_ (import Link rather than import { Link }).

@gaearon You are right!
Last night,I solved the problem!
I was so careless...
Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings