-
Notifications
You must be signed in to change notification settings - Fork 0
side-effects #69
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
Comments
スナックバーを表示するなどの 1 回限りのイベントをトリガーする場合や、特定の状態で別の画面に移動する場合などに、副作用(side-effects)が必要になることがあります。 |
LaunchedEffectコンポーザブル内から suspend 関数を安全に呼び出すには、LaunchedEffectコンポーザブルを使用します。 |
#69 LaunchedEffect: run suspend functions in the scope of a composable
rememberCoroutineScopeコンポーザブルの外部でコルーチンを起動するために、Composition から退場すると自動的にキャンセルされるスコープを設定するには、rememberCoroutineScope を使用します。 |
rememberUpdatedState値が変化しても再起動されない作用の値をキャプチャしたい場合に利用する。 refsLeoAndo/development-conference-memo#396 |
DisposableEffectキーが変化した後またはコンポーザブルが Composition から退場したときにクリーンアップする必要がある副作用については、DisposableEffect を使用します。 |
SideEffectCompose が管理していないオブジェクトと Compose の状態を共有するには、再コンポジションが成功するたびに呼び出される SideEffect コンポーザブルを使用します。 |
produceStateproduceState は、Composition をスコープとするコルーチンを起動します。これにより、返される State に値をプッシュできます。これを使用して、Compose 外の状態を Compose の状態に変換できます。 |
derivedstateofusecase: 特定の状態が他の状態オブジェクトから計算(導出)される場合は、derivedStateOf を使用します。この関数を使用すると、計算で使用される状態のいずれかが変化したときにのみ計算が行われることが保証されます。 |
snapshotFlowCompose の State を Flow に変換するためのもの 参考: |
Uh oh!
There was an error while loading. Please reload this page.
https://developer.android.com/jetpack/compose/side-effects
https://developer.android.com/codelabs/jetpack-compose-advanced-state-side-effects?hl=ja#0
The text was updated successfully, but these errors were encountered: