Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
KingYYH opened this issue Feb 12, 2019 · 9 comments
Closed

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

KingYYH opened this issue Feb 12, 2019 · 9 comments
Labels
question Further information is requested

Comments

@KingYYH
Copy link

KingYYH commented Feb 12, 2019

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)

@taro-bot
Copy link

taro-bot bot commented Feb 12, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@KingYYH
Copy link
Author

KingYYH commented Feb 12, 2019

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

@luckyadam
Copy link
Member

不要对 App 使用 redux 连接

@taro-bot
Copy link

taro-bot bot commented Apr 8, 2019

Hello~

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

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

Good luck and happy coding~

@taro-bot taro-bot bot removed the to be closed label Apr 12, 2019
@taro-bot taro-bot bot closed this as completed Apr 12, 2019
@EvanMaFYH
Copy link

不要对 App 使用 redux 连接

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

@summer-yyyn
Copy link

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

@HUYIJUNCODING
Copy link

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

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

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

@shengbowen
Copy link

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

@54853315
Copy link

54853315 commented May 29, 2020

  • 我这里也遇到同样问题,可是并没有使用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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants