Skip to main content
Version: 0.1.2

Type Alias: FetchStateAccessor

Imported from @react-logic/utils

FetchStateAccessor<T, Args> = () => FetchStateValue<T> & object

Reactive / imperative fetch accessor. () reads the state; .fetch either fires a new request with the given args (writing the wrapped input signal for reactive, running the build callback for imperative) or — when called with no args — re-runs the last request.

Type Declaration​

[REACTIVE_ACCESSOR_MARKER]​

[REACTIVE_ACCESSOR_MARKER]: true

fetch​

fetch: {(...args): void; (): void; }

Fire a request with the given arguments. With no arguments, re-fire the last request — current input for reactive, most recent .fetch(...) args for imperative.

Call Signature​

(...args): void

Parameters​
args​

...Args

Returns​

void

Call Signature​

(): void

Returns​

void

Type Parameters​

T​

T

The parsed response type.

Args​

Args extends readonly unknown[]

The build callback's argument tuple. [] for the 0-param reactive form.