useMount为什么是用的LaunchedEffect而不是SideEffect? #6
-
RT useUnmount用的是DisposableEffect |
Beta Was this translation helpful? Give feedback.
Answered by
junerver
May 8, 2024
Replies: 1 comment
-
因为很常见的一个需求是在组件mount时执行一些挂起函数,例如网络请求,这个钩子被设计成只执行一次,所以不可以使用SideEffect |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
junerver
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
因为很常见的一个需求是在组件mount时执行一些挂起函数,例如网络请求,这个钩子被设计成只执行一次,所以不可以使用SideEffect