taro 编译h5 Cannot read property 'dispatch' of undefined

Created on 12 Feb 2019  ·  9Comments  ·  Source: NervJS/taro

index.js?ef09:574 Uncaught TypeError: Cannot read property 'dispatch' of undefined
at Connect.initSelector (index.js?ef09:574)
at new Connect (index.js?ef09:502)
at mountComponent (index.js?36eb:1521)
at ComponentWrapper.init (index.js?36eb:1871)
at createElement (index.js?36eb:1385)
at mountVNode (index.js?36eb:1517)
at Object.render (index.js?36eb:1797)
at eval (app.js?d0a8:404)
at Object../.temp/app.js (app.js:950)
at __webpack_require__ (app.js:765)

question

All 9 comments

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

编译小程序是正常的,版本依赖都是最新 node 8.11.4

不要对 App 使用 redux 连接

Hello~

您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

不要对 App 使用 redux 连接

在微信小程序下对App使用redux没有报错,应该没啥问题吧如果我只需要编译小程序的话,因为我需要在小程序启动的时候将storage中的内容存到state里

遇到同样的问题,请问有解决办法么?

  • 我这里也遇到同样问题,可是并没有使用connet进行redux连接,关于store的关联写法如下,应该没有问题吧

```js
import {Provider} from '@tarojs/redux'
import StoreUtil from "./store/stateStore";

const store = StoreUtil.getStore();
...

render() {
return (

)
}

有什么解决方法吗,难道各位都没有redux持久化的需求吗

  • 我这里也遇到同样问题,可是并没有使用connet进行redux连接,关于store的关联写法如下,应该没有问题吧
import {Provider} from '@tarojs/redux'
import StoreUtil from "./store/stateStore";

const store = StoreUtil.getStore();
...

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

我在taro2.2.6(目前v2系最高版本)中,运行H5,可以正常打印出console.log(store)

同时请注意这里提到的细节:https://taro-docs.jd.com/taro/docs/redux/#hooks 这里说到所需的依赖,如果你是用正常的方式安装taro2.2.6,则不用再刻意去安装依赖。

taro官方的redux example:https://github.com/NervJS/taro-redux-sample

Was this page helpful?
0 / 5 - 0 ratings