1

This works:

const Router = connect()(Router);

// --- your exported main router
export default class MyExportedRouter extends React.Component {
    constructor(props) {
        super(props);
    };

    render() {
        return (
            <Provider store={store}>
                <Router scenes={scenes} />
            </Provider>
        );
    }
}

But if I change

const Router = connect()(Router);
...
<Router scenes={scenes} />
...

to

const myConnectedRouter = connect()(Router);
...
<myConnectedRouter scenes={scenes} />
...

It fails with the following error:

looking for an class component, gets an object object

My full code is here: https://github.com/aksonov/react-native-router-flux/blob/master/docs/REDUX_FLUX.md

Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62
user2906608
  • 123
  • 10

1 Answers1

0

myConnectedRouter should be capitalized, as in MyConnectedRouter

connect() returns a 'higher order React component class' (https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options)

React components must be capitalized (https://facebook.github.io/react/docs/jsx-in-depth.html#html-tags-vs.-react-components)

This question has been addressed in the context of ReactJS here: https://stackoverflow.com/a/30373505/1905712

Community
  • 1
  • 1
Joseph Mark
  • 9,298
  • 4
  • 29
  • 31