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 3.6 react入口组件app.ts文件中使用Provider设置全局状态 ,文件是.ts,使用不了redux的Provider组件,这怎么解决 #16888

Open
1648298170 opened this issue Nov 19, 2024 · 2 comments

Comments

@1648298170
Copy link

相关平台

微信小程序

小程序基础库: 3.6.5
使用框架: React

复现步骤

app.ts文件
function App({ children }: PropsWithChildren) {

useLaunch(() => {
console.log('App launched.')
console.log("children",children)
})

// children
return (
// 在入口组件不会渲染任何内容,但我们可以在这里做类似于状态管理的事情

{children}

)
}

期望结果

能成功在app.ts中通过Provider组件注入store

实际结果

没有成功

环境信息

👽 Taro v3.6.35


  Taro CLI 3.6.35 environment info:
    System:
      OS: Windows 11 10.0.22631
    Binaries:
      Node: 18.20.4 - D:\nvm\node\node.EXE
      npm: 10.7.0 - D:\nvm\node\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.35 => 3.6.35
      @tarojs/components: 3.6.35 => 3.6.35
      @tarojs/helper: 3.6.35 => 3.6.35
      @tarojs/plugin-framework-react: 3.6.35 => 3.6.35
      @tarojs/plugin-platform-alipay: 3.6.35 => 3.6.35
      @tarojs/plugin-platform-h5: 3.6.35 => 3.6.35
      @tarojs/plugin-platform-jd: 3.6.35 => 3.6.35
      @tarojs/plugin-platform-qq: 3.6.35 => 3.6.35
      @tarojs/plugin-platform-swan: 3.6.35 => 3.6.35
      @tarojs/plugin-platform-tt: 3.6.35 => 3.6.35
      @tarojs/plugin-platform-weapp: 3.6.35 => 3.6.35
      @tarojs/react: 3.6.35 => 3.6.35
      @tarojs/runtime: 3.6.35 => 3.6.35
      @tarojs/shared: 3.6.35 => 3.6.35
      @tarojs/taro: 3.6.35 => 3.6.35
      @tarojs/taro-loader: 3.6.35 => 3.6.35
      @tarojs/webpack5-runner: 3.6.35 => 3.6.35
      babel-preset-taro: 3.6.35 => 3.6.35
      eslint-config-taro: 3.6.35 => 3.6.35
      react: ^18.0.0 => 18.3.1
@thunderstreak
Copy link

把ts改成tsx

@1648298170
Copy link
Author

把ts改成tsx

谢谢,因为一开始改为tsx,重新编译会报找不到app.ts文件,实在没找到解决方案,现在改为tsx重启又可以了,不知道为啥

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

No branches or pull requests

2 participants