We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
via: https://nervjs.github.io/taro/docs/hooks.html
The text was updated successfully, but these errors were encountered:
It requires a more generic implementation of useStore.
src/index.tsx
import { PureComponent, useEffect, useState } from 'react' // 👇 👇 // import { useEffect, useState } from '@tarojs/taro' // ....... const useStore = (modelName: string, depActions?: string[]) => { const setState = useState(Global.State[modelName])[1] useEffect(() => { Global.uid += 1 const hash = '' + Global.uid if (!Global.Setter.functionSetter[modelName]) { Global.Setter.functionSetter[modelName] = {} } Global.Setter.functionSetter[modelName][hash] = { setState, depActions } return function cleanup() { delete Global.Setter.functionSetter[modelName][hash] } }, []) const updaters = getActions(modelName, { setState, type: 'function' }) return [getState(modelName), updaters] }
Sorry, something went wrong.
I have implemented a lib for Taro, see https://github.com/kyleslight/react-model-taro
No branches or pull requests
via: https://nervjs.github.io/taro/docs/hooks.html
The text was updated successfully, but these errors were encountered: