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-redux 使用报错 #7555

Closed
whitedesignd opened this issue Sep 8, 2020 · 5 comments
Closed

taro-redux 使用报错 #7555

whitedesignd opened this issue Sep 8, 2020 · 5 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@whitedesignd
Copy link

相关平台

微信小程序

复现仓库

git@github.com:whitedesignd/taro-music.git
小程序基础库: 2.12.1
使用框架: React

复现步骤

安装官网步骤安装 使用taro-redux,报错

期望结果

使用 taro-redux

实际结果

不能使用,可以使用react-redux

环境信息

� Taro v3.0.8


  Taro CLI 3.0.8 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.0.0 - D:\nvm\node\node.EXE
      Yarn: 1.19.1 - D:\yarn\bin\yarn.CMD
      npm: 6.14.4 - D:\nvm\node\npm.CMD

补充信息

可以使用react-redux。
使用taro-redux 报错信息
TypeError: Cannot call a class as a function
TypeError: Cannot call a class as a function
Cannot read property 'mount' of undefined
TypeError: Cannot read property 'mount' of undefined

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Sep 8, 2020
@suiyuex
Copy link

suiyuex commented Sep 8, 2020

@whitedesignd 能不能提供一下入口文件的内容

@whitedesignd
Copy link
Author

@whitedesignd 能不能提供一下入口文件的内容

import React,{Component}from 'react';
import './app.less'
import 'taro-ui/dist/style/index.scss'
import { Provider } from '@tarojs/redux'
import configStore from './redux/store.js'
const store = configStore()
class App extends Component {
// this.props.children 是将要会渲染的页面
render() {
return
{this.props.children}

}
}
export default App

@suiyuex
Copy link

suiyuex commented Sep 8, 2020

@whitedesignd 目前使用redux还是需要使用社区包reduxreact-redux由于官方包@tarojs/redux@tarojs/redux-h5这两个包其内部尚未实现Providerredux是一个js包,react-redux基于react,taro是基本支持所有jsx语法的,所以无需担心跨端兼容性问题

@Chen-jj
Copy link
Contributor

Chen-jj commented Sep 9, 2020

@suiyuex 使用 react-redux。文档改了还没发版,看 next 版本的文档。

@Chen-jj Chen-jj closed this as completed Sep 9, 2020
@suiyuex
Copy link

suiyuex commented Sep 9, 2020

最新文档可以通过此网址查看: https://nervjs.github.io/taro/docs/next/redux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

3 participants