altjs / utils

A collection of utils for alt.js
37 stars 25 forks source link

connectToStores not works as expected? #8

Open Bogdaan opened 8 years ago

Bogdaan commented 8 years ago

For example:

npm install --save alt alt-utils

import connectToStores from 'alt-utils/lib/connectToStores';
import TodoStore from '../../stores/TodoStore'

class Todo extends Component {
    static getStores() {
      return [TodoStore];
    }

    static getPropsFromStores() {
      return TodoStore.getState();
    }    
}
export default connectToStores(Todo)

Result:

Error: connectToStores() expects the wrapped component to have a static getStores() method
    at /node_modules/alt-utils/lib/connectToStores.js:65:13
    at connectToStores (/node_modules/alt-utils/lib/connectToStores.js:113:5)
    at Object.<anonymous> (/build/webpack:/src/components/Todo/index.jsx:1213:16)
    at __webpack_require__ (/build/webpack:/webpack/bootstrap 1e13b48f6ed5c94ceb23:19:1)
    at Object.module.exports.Object.defineProperty.value (/build/webpack:/src/routes.js:24:63)
    at __webpack_require__ (/build/webpack:/webpack/bootstrap 1e13b48f6ed5c94ceb23:19:1)
    at Object.<anonymous> (/build/webpack:/src/server.js:7:40)
    at __webpack_require__ (/build/webpack:/webpack/bootstrap 1e13b48f6ed5c94ceb23:19:1)
    at module.exports._this2 (/build/webpack:/webpack/bootstrap 1e13b48f6ed5c94ceb23:39:1)
    at Object.<anonymous> (/build/webpack:/webpack/bootstrap 1e13b48f6ed5c94ceb23:39:1)
tonilaukka commented 8 years ago

I'm having exactly same propblem. Did you find a solution to this?