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)
For example:
Result: