rememberQuery

fun <T> rememberQuery(key: QueryKey<T>, config: QueryConfig = QueryConfig.Default, client: QueryClient = LocalQueryClient.current): QueryObject<T>

Remember a QueryObject and subscribes to the query state of key.

Return

A QueryObject each the query state changed.

Parameters

T

Type of data to retrieve.

key

The QueryKey for managing query.

config

The configuration for the query. By default, it uses the QueryConfig.Default.

client

The QueryClient to resolve key. By default, it uses the LocalQueryClient.


fun <T, U> rememberQuery(key: QueryKey<T>, select: (T) -> U, config: QueryConfig = QueryConfig.Default, client: QueryClient = LocalQueryClient.current): QueryObject<U>

Remember a QueryObject and subscribes to the query state of key.

Return

A QueryObject with selected data each the query state changed.

Parameters

T

Type of data to retrieve.

U

Type of selected data.

key

The QueryKey for managing query.

select

A function to select data from T.

config

The configuration for the query. By default, it uses the QueryConfig.Default.

client

The QueryClient to resolve key. By default, it uses the LocalQueryClient.


fun <T1, T2, R> rememberQuery(key1: QueryKey<T1>, key2: QueryKey<T2>, transform: (T1, T2) -> R, config: QueryConfig = QueryConfig.Default, client: QueryClient = LocalQueryClient.current): QueryObject<R>

Remember a QueryObject and subscribes to the query state of key1 and key2.

Return

A QueryObject with transformed data each the query state changed.

Parameters

T1

Type of data to retrieve from key1.

T2

Type of data to retrieve from key2.

R

Type of data to transform.

key1

The QueryKey for managing query.

key2

The QueryKey for managing query.

transform

A function to transform T1 and T2 into R.

config

The configuration for the query. By default, it uses the QueryConfig.Default.

client

The QueryClient to resolve key1 and key2. By default, it uses the LocalQueryClient.


fun <T1, T2, T3, R> rememberQuery(key1: QueryKey<T1>, key2: QueryKey<T2>, key3: QueryKey<T3>, transform: (T1, T2, T3) -> R, config: QueryConfig = QueryConfig.Default, client: QueryClient = LocalQueryClient.current): QueryObject<R>

Remember a QueryObject and subscribes to the query state of key1, key2, and key3.

Return

A QueryObject with transformed data each the query state changed.

Parameters

T1

Type of data to retrieve from key1.

T2

Type of data to retrieve from key2.

T3

Type of data to retrieve from key3.

R

Type of data to transform.

key1

The QueryKey for managing query.

key2

The QueryKey for managing query.

key3

The QueryKey for managing query.

transform

A function to transform T1, T2, and T3 into R.

config

The configuration for the query. By default, it uses the QueryConfig.Default.

client

The QueryClient to resolve key1, key2, and key3. By default, it uses the LocalQueryClient.


fun <T, R> rememberQuery(keys: List<QueryKey<T>>, transform: (List<T>) -> R, config: QueryConfig = QueryConfig.Default, client: QueryClient = LocalQueryClient.current): QueryObject<R>

Remember a QueryObject and subscribes to the query state of keys.

Return

A QueryObject with transformed data each the query state changed.

Parameters

T

Type of data to retrieve.

R

Type of data to transform.

keys

The list of QueryKey for managing query.

transform

A function to transform T into R.

config

The configuration for the query. By default, it uses the QueryConfig.Default.

client

The QueryClient to resolve keys. By default, it uses the LocalQueryClient.