How to use the @tarojs/redux.useDispatch function in @tarojs/redux

To help you get started, we’ve selected a few @tarojs/redux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zhixiaoqiang / taroCloud / src / pages / trending / index-hook.js View on Github external
export default function Index () {
  const [state, events, loading, error] = usePage(init)
  const dispatch = useDispatch()

  useMount(() => {
    // 获取用户信息
    Taro.getSetting({
      success: res => {
        if (res.authSetting['scope.userInfo']) {
          // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
          Taro.getUserInfo({
            success: result => {
              events.saveUserInfo(result.userInfo, dispatch)
            },
            fail: err => console.warn(err),
          })
        }
      },
    })
github zhixiaoqiang / taroCloud / src / pages / login / index.js View on Github external
export default function Index () {
  const [state, events, loading] = usePage(init)
  const dispatch = useDispatch()
  useDidShow(() => {
    events.initData(dispatch)
  })

  return (

@tarojs/redux

Redux for Taro

MIT
Latest version published 4 years ago

Package Health Score

70 / 100
Full package analysis