React-redux: invalid return type

Created on 14 Dec 2018  ·  5Comments  ·  Source: reduxjs/react-redux

I can provide more info as needed.

Using react-redux v6.0.0
react v16.6.0
I received this error.

"Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object."

I followed the boilerplate implementation like below.

import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import rootReducer from './reducers'
import App from './components/App'

const store = createStore(rootReducer)

render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.getElementById('root')
)

console reported the error occurred in the return from var permanentRegister

switching to react-redux v5.1.1 fixed the problem

Most helpful comment

Seems like a bug to me. Following the documentation exactly throws an error. Changing versions (and nothing else) fixed the error. Presumably you have a bug in the new version, or it's incompatible.

All 5 comments

This is a bug tracker, not a support system. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out. Thanks!

Seems like a bug to me. Following the documentation exactly throws an error. Changing versions (and nothing else) fixed the error. Presumably you have a bug in the new version, or it's incompatible.

@timdorr : I came here to file the same issue. When using yarn add react-redux I got the latest version (6.0.0). I followed redux documentation and spent ~an hour trying to figure out what was going wrong and why I kept getting:

I ended up looking at the versions exactly used in the redux example codesandbox: https://codesandbox.io/s/9on71rvnyo, downgraded to ^5.0.7 and it worked.

This definitely feels like a bug and/or an API change. Please do not disregard as others will very likely run into this same issue.

I wasn't able to reproduce it with just a codesandbox fork of the redux documentation example: https://codesandbox.io/s/x3qkwjroqz so I'm wondering if maybe Webpack may be the culprit with the latest version as that is likely the only difference?

I am using a default webpack config in Rails with webpacker v3.5.5

Please provide a project that specifically reproduces the issue - we can't do much investigating without that.

😞 I tried re-creating in a fresh Rails app with Webpacker, but failed. 🤷‍♂️

Was this page helpful?
0 / 5 - 0 ratings