Skip to content

1个页面使用多个hook #666

Closed Answered by MeetinaXD
FlyingOnion asked this question in Q&A
Discussion options

You must be logged in to vote

解构后重名即可

const { data: dataA, loading: loadingA, error: errorA } = useRequest(method1);
const { data: dataB, loading: loadingB, error: errorB } = useWatcher(() => method2(), [...]); // 会报错

不解构使用时视图不更新的原因是alova内有依赖收集,在首次渲染时未使用的导出不会被更新

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by FlyingOnion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants