question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`connect` not running on on exported component class

See original GitHub issue

To be honest I’m not sure if this is the right repo but I’m at an impasse and this is the most obvious place for now.

I have a simple test repo. It is heavily based off the redux-router basic example but simplified for this example.

Among other webpack-esque things the following react/redux libs are installed:

  "dependencies": {
    "history": "^1.12.5",
    "react": "^0.14.0",
    "react-dom": "^0.14.0",
    "react-redux": "^4.0.0",
    "react-router": "^1.0.0-rc3",
    "redux": "^3.0.2",
    "redux-router": "^1.0.0-beta3"
  },

Fairly standard stuff.

There are two files worth looking at:

index.jsx - Basically a whole application App.jsx - The main component exported to a separate file.

When run in one file, index.jx the application work as expected. The component receives props from the @connect-ed store, all good and happy. Routes run, props are passed, everyone gets what they want.

In the name of splitting things out for a real project I started by moving the main App component to a separate file. When I do this however the @connect-ing doesn’t appear to work. This is first made clear by the Props warning that appears.

Warning: Failed propType: Required prop `routerState` was not specified in `App`. Check the render method of `RoutingContext`.

This points to redux-router however after adding some logging I can see that the @connect mapStateToProps function is not being called when exporting the component.

This all seems very odd to me but tbh it could point to any number of places. The eco system is moving very quickly and its hard to keep up.

Is there an issue with react-redux, @connect, webpack, babel, redux-router or any of the (incredible) hot reloading features?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jamiebuildscommented, Mar 5, 2016

tries not to gloat

IN YO FACE ABRAMOV!!!

(jk I luv u buddy)

0reactions
gaearoncommented, Mar 5, 2016

@thejameskyle would so love this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does my React Component Export not work?
The Hello component comes from my hello.js in the same folder: import React from 'react'; class Hello ...
Read more >
How to Export a Connected Component - Dave Ceddia
Import a Connected Component ... The general rule of thumb is this: if something is export default , you will import it with...
Read more >
ReactJS | Importing and Exporting - GeeksforGeeks
Thus, it is possible to import/export React Components and is one of the basic operations to be performed. In React we use the...
Read more >
JavaScript modules - MDN Web Docs
Exporting module features ... The first thing you do to get access to module features is export them. This is done using the...
Read more >
Behavior changes: Apps targeting Android 12
Install your app on a device or emulator running Android 12. ... If the app component includes the LAUNCHER category, set android:exported to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found