# [API](/api/) › @qwik.dev/qwik

## "q:slot"

```typescript
'q:slot'?: string;
```

## "xlink:actuate"

```typescript
'xlink:actuate'?: string | undefined;
```

## "xlink:arcrole"

```typescript
'xlink:arcrole'?: string | undefined;
```

## "xlink:href"

```typescript
'xlink:href'?: string | undefined;
```

## "xlink:role"

```typescript
'xlink:role'?: string | undefined;
```

## "xlink:show"

```typescript
'xlink:show'?: string | undefined;
```

## "xlink:title"

```typescript
'xlink:title'?: string | undefined;
```

## "xlink:type"

```typescript
'xlink:type'?: string | undefined;
```

## "xml:base"

```typescript
'xml:base'?: string | undefined;
```

## "xml:lang"

```typescript
'xml:lang'?: string | undefined;
```

## "xml:space"

```typescript
'xml:space'?: string | undefined;
```

## "xmlns:xlink"

```typescript
'xmlns:xlink'?: string | undefined;
```

## $

Qwik Optimizer marker function.

Use `$(...)` to tell Qwik Optimizer to extract the expression in `$(...)` into a lazy-loadable resource referenced by `QRL`.

```typescript
$: <T>(expression: T) => QRL<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| expression | T | Expression which should be lazy loaded |

**Returns:**

[QRL](#qrl-type-alias)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/qrl.public.ts)

## abort

Abort the current computation and run cleanups if needed.

```typescript
abort(reason?: any): void;
```

| Parameter | Type | Description |
| --- | --- | --- |
| reason | any | _(Optional)_ |

**Returns:**

void

## AsyncFn

> Warning: This API is now obsolete.
>
> Use `ComputedFn` instead.

```typescript
export type AsyncFn<T> = ComputedFn<T>;
```

**References:** [ComputedFn](#computedfn)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts)

## AsyncSignal

> Warning: This API is now obsolete.
>
> Use `ComputedSignal` instead, it has async support now.

An AsyncSignal holds the result of the given async function. If the function uses `track()` to track reactive state, and that state changes, the AsyncSignal is recalculated, and if the result changed, all tasks which are tracking the AsyncSignal will be re-run and all subscribers (components, tasks etc) that read the AsyncSignal will be updated.

If the async function throws an error, the AsyncSignal will capture the error and set the `error` property. The error can be cleared by re-running the async function successfully.

While the async function is running, the `.loading` property will be set to `true`. Once the function completes, `loading` will be set to `false`.

If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will retry the component or task once the value resolves.

If the value has been resolved, but the async function is re-running, reading the AsyncSignal will subscribe to it and return the last resolved value until the new value is ready. As soon as the new value is ready, the subscribers will be updated.

If the async function threw an error, reading the `.value` will throw that same error. Read from `.error` to check if there was an error.

```typescript
export type AsyncSignal<T = unknown> = ComputedSignal<T>;
```

**References:** [ComputedSignal](#computedsignal)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/signal.public.ts)

## AsyncSignalOptions

> Warning: This API is now obsolete.
>
> Use `ComputedOptions` instead.

```typescript
export type AsyncSignalOptions<T> = ComputedOptions<T>;
```

**References:** [ComputedOptions](#computedoptions)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/types.ts)

## cache

> Warning: This API is now obsolete.
>
> Does not do anything

```typescript
cache(policyOrMilliseconds: number | 'immutable'): void;
```

| Parameter | Type | Description |
| --- | --- | --- |
| policyOrMilliseconds | number \\| 'immutable' |  |

**Returns:**

void

## ClassList

A class list can be a string, a boolean, an array, or an object.

If it's an array, each item is a class list and they are all added.

If it's an object, then the keys are class name strings, and the values are booleans that determine if the class name string should be added or not.

```typescript
export type ClassList =
  | string
  | undefined
  | null
  | false
  | Record<string, boolean | string | number | null | undefined>
  | ClassList[];
```

**References:** [ClassList](#classlist)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## cleanup

```typescript
cleanup(): void;
```

**Returns:**

void

## clear

Clear the value and recompute. Unlike `invalidate()`, readers see the loading state (reads throw the computation promise) instead of the stale value while the new value computes.

```typescript
clear(): void;
```

**Returns:**

void

## Component

Type representing the Qwik component.

`Component` is the type returned by invoking `component$`.

```tsx
interface MyComponentProps {
  someProp: string;
}
const MyComponent: Component<MyComponentProps> = component$(
  (props: MyComponentProps) => {
    return <span>{props.someProp}</span>;
  },
);
```

```typescript
export type Component<PROPS = unknown> = FunctionComponent<PublicProps<PROPS>>;
```

**References:** [FunctionComponent](#functioncomponent), [PublicProps](#publicprops)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/component.public.ts)

## component$

Declare a Qwik component that can be used to create UI.

Use `component$` to declare a Qwik component. A Qwik component is a special kind of component that allows the Qwik framework to lazy load and execute the component independently of other Qwik components as well as lazy load the component's life-cycle hooks and event handlers.

Side note: You can also declare regular (standard JSX) components that will have standard synchronous behavior.

Qwik component is a facade that describes how the component should be used without forcing the implementation of the component to be eagerly loaded. A minimum Qwik definition consists of:

### Example

An example showing how to create a counter component:

```tsx
export interface CounterProps {
  initialValue?: number;
  step?: number;
}
export const Counter = component$((props: CounterProps) => {
  const state = useSignal(props.initialValue || 0);
  return (
    <div>
      <span>{state.value}</span>
      <button onClick$={() => (state.value += props.step || 1)}>+</button>
    </div>
  );
});
```

- `component$` is how a component gets declared. - `{ value?: number; step?: number }` declares the public (props) interface of the component. - `{ count: number }` declares the private (state) interface of the component.

The above can then be used like so:

```tsx
export const OtherComponent = component$(() => {
  return <Counter initialValue={100} />;
});
```

See also: `component`, `useCleanup`, `onResume`, `onPause`, `useOn`, `useOnDocument`, `useOnWindow`, `useStyles`

```typescript
component$: <PROPS = unknown>(onMount: OnRenderFn<PROPS>) => Component<PROPS>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| onMount | [OnRenderFn](#onrenderfn)<PROPS> |  |

**Returns:**

[Component](#component)&lt;PROPS&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/component.public.ts)

## ComponentBaseProps

```typescript
export interface ComponentBaseProps
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| ["q:slot"?](#componentbaseprops-_q_slot_) |  | string | _(Optional)_ |
| key? |  | string \\| number \\| null \\| undefined | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## ComputedFn

The compute function. The context provides `track()`, `previous` (the last computed value), `info` (the argument of the `invalidate(info)` call that triggered this computation), `cleanup()` and `abortSignal`. Synchronous reactive state reads are tracked automatically, use `untrack()` to read signals without tracking. Return a `Promise` (or use an `async` function) for async values. After the first `await`, reads are no longer tracked automatically and must use `track()`.

```typescript
export type ComputedFn<T> = (ctx: ComputeCtx) => ValueOrPromise<T>;
```

**References:** [ValueOrPromise](#valueorpromise)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts)

## ComputedOptions

```typescript
export interface ComputedOptions<T = unknown>
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| clientOnly? |  | boolean | _(Optional)_ When true, the async computation is postponed to the browser. On SSR, the signal remains INVALID and does not execute the function. On the client, it will compute on first read. Defaults to `false`. |
| concurrency? |  | number | _(Optional)_ Maximum number of concurrent computations. Use `0` for unlimited. Defaults to `1`. |
| container? |  | Container | _(Optional)_ |
| eagerCleanup? |  | boolean | _(Optional)_ When subscribers drop to 0, run cleanup in the next tick, instead of waiting for the function inputs to change. Defaults to `false`, meaning cleanup happens only when inputs change. |
| initial? |  | Awaited<T> \\| (() => Awaited<T>) | _(Optional)_ Like useSignal's `initial`; prevents the throw on first read when uninitialized |
| serializationStrategy? |  | [SerializationStrategy](#serializationstrategy) | _(Optional)_ |
| timeout? |  | number | _(Optional)_ Maximum time in milliseconds to wait for the async computation to complete. If exceeded, the computation is aborted and an error is thrown. If `0`, no timeout is applied. Defaults to `0`. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/types.ts)

## ComputedReturnType

```typescript
export type ComputedReturnType<T> = ComputedSignal<Awaited<T>>;
```

**References:** [ComputedSignal](#computedsignal)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts)

## ComputedSignal

A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated, and if the result changed, all tasks which are tracking the signal will be re-run and all components that read the signal will be re-rendered.

```typescript
export interface ComputedSignal<T> extends Signal<T>
```

**Extends:** [Signal](#signal)&lt;T&gt;

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| error |  | Error \\| undefined | The error that occurred while computing the signal, if any, including synchronous throws. This will be cleared when the signal is successfully computed. It also triggers lazy computation of the signal. While the error is set, reading `.value` throws it. |
| loading |  | boolean |  |
| pending |  | boolean | Whether the signal is currently loading. This will trigger lazy computation of the signal, so you can use it like this: ```tsx signal.pending ? ( ) : signal.error ? ( ) : ( ); ``` |
| untrackedError |  | Error \\| undefined | Lets you read the error state without subscribing to `.error` updates. It also triggers lazy computation of the signal. Setting it will trigger listeners for `.error`. |
| untrackedLoading |  | boolean |  |
| untrackedPending |  | boolean | Lets you read the pending state without subscribing to `.pending` updates. It also triggers lazy computation of the signal. Setting it will trigger listeners for `.pending`. |

| Method | Description |
| --- | --- |
| [abort(reason)](#computedsignal-abort) | Abort the current computation and run cleanups if needed. |
| [clear()](#computedsignal-clear) | Clear the value and recompute. Unlike `invalidate()`, readers see the loading state (reads throw the computation promise) instead of the stale value while the new value computes. |
| [force()](#computedsignal-force) |  |
| [invalidate()](#computedsignal-invalidate) | Use this to force recalculation. |
| invalidate(info) | Use this to force recalculation. If you pass `info`, it will be provided to the calculation function. |
| [promise()](#computedsignal-promise) | A promise that resolves when the value is computed or rejected. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/signal.public.ts)

## ContextId

ContextId is a typesafe ID for your context.

Context is a way to pass stores to the child components without prop-drilling.

Use `createContextId()` to create a `ContextId`. A `ContextId` is just a serializable identifier for the context. It is not the context value itself. See `useContextProvider()` and `useContext()` for the values. Qwik needs a serializable ID for the context so that the it can track context providers and consumers in a way that survives resumability.

### Example

```tsx
// Declare the Context type.
interface TodosStore {
  items: string[];
}
// Create a Context ID (no data is saved here.)
// You will use this ID to both create and retrieve the Context.
export const TodosContext = createContextId<TodosStore>("Todos");

// Example of providing context to child components.
export const App = component$(() => {
  useContextProvider(
    TodosContext,
    useStore<TodosStore>({
      items: ["Learn Qwik", "Build Qwik app", "Profit"],
    }),
  );

  return <Items />;
});

// Example of retrieving the context provided by a parent component.
export const Items = component$(() => {
  const todos = useContext(TodosContext);
  return (
    <ul>
      {todos.items.map((item) => (
        <li>{item}</li>
      ))}
    </ul>
  );
});
```

```typescript
export interface ContextId<STATE>
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| \_\_brand_context_type\_\_ | `readonly` | STATE | Design-time property to store type information for the context. |
| id | `readonly` | string | A unique ID for the context. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-context.ts)

## CorePlatform

Low-level API for platform abstraction.

Different platforms (browser, node, service workers) may have different ways of handling things such as `requestAnimationFrame` and imports. To make Qwik platform-independent Qwik uses the `CorePlatform` API to access the platform API.

`CorePlatform` also is responsible for importing symbols. The import map is different on the client (browser) then on the server. For this reason, the server has a manifest that is used to map symbols to javascript chunks. The manifest is encapsulated in `CorePlatform`, for this reason, the `CorePlatform` can't be global as there may be multiple applications running at server concurrently.

This is a low-level API and there should not be a need for you to access this.

```typescript
export interface CorePlatform
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| chunkForSymbol |  | (symbolName: string, chunk: string \\| null, parent?: string) => readonly [symbol: string, chunk: string] \\| undefined | Retrieve chunk name for the symbol. When the application is running on the server the symbols may be imported from different files (as server build is typically a single javascript chunk.) For this reason, it is necessary to convert the chunks from server format to client (browser) format. This is done by looking up symbols (which are globally unique) in the manifest. (Manifest is the mapping of symbols to the client chunk names.) |
| importSymbol |  | (containerEl: Element \\| undefined, url: string \\| URL \\| undefined \\| null, symbol: string) => [ValueOrPromise](#valueorpromise)<unknown> | Retrieve a symbol value from QRL. Qwik needs to lazy load data and closures. For this Qwik uses QRLs that are serializable references of resources that are needed. The QRLs contain all the information necessary to retrieve the reference using `importSymbol`. Why not use `import()`? Because `import()` is relative to the current file, and the current file is always the Qwik framework. So QRLs have additional information that allows them to serialize imports relative to application base rather than the Qwik framework file. |
| isServer |  | boolean | True of running on the server platform. |
| raf |  | (fn: () => any) => Promise<any> | Perform operation on next request-animation-frame. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/platform/types.ts)

## CorrectedToggleEvent

This corrects the TS definition for ToggleEvent

```typescript
export interface CorrectedToggleEvent extends Event
```

**Extends:** Event

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| newState | `readonly` | 'open' \\| 'closed' |  |
| prevState | `readonly` | 'open' \\| 'closed' |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## createComputed$

Create a computed signal which is calculated from the given QRL. A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated.

The QRL must be a function which returns the value of the signal. The function must not have side effects. Every synchronous signal or store read is tracked automatically; reads after the first `await` must use the `track()` provided on the context argument. When the function is async, the returned signal exposes the async API (`.pending`, `.error`, `.promise()`), and reading an unresolved `.value` throws the computation promise.

```typescript
createComputed$: <T>(
  qrl: (ctx: ComputeCtx) => ValueOrPromise<T>,
  options?: ComputedOptions<T>,
) => ComputedReturnType<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| qrl | (ctx: ComputeCtx) => [ValueOrPromise](#valueorpromise)<T> |  |
| options | [ComputedOptions](#computedoptions)<T> | _(Optional)_ |

**Returns:**

[ComputedReturnType](#computedreturntype)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/signal.public.ts)

## createContextId

Create a context ID to be used in your application. The name should be written with no spaces.

Context is a way to pass stores to the child components without prop-drilling.

Use `createContextId()` to create a `ContextId`. A `ContextId` is just a serializable identifier for the context. It is not the context value itself. See `useContextProvider()` and `useContext()` for the values. Qwik needs a serializable ID for the context so that the it can track context providers and consumers in a way that survives resumability.

### Example

```tsx
// Declare the Context type.
interface TodosStore {
  items: string[];
}
// Create a Context ID (no data is saved here.)
// You will use this ID to both create and retrieve the Context.
export const TodosContext = createContextId<TodosStore>("Todos");

// Example of providing context to child components.
export const App = component$(() => {
  useContextProvider(
    TodosContext,
    useStore<TodosStore>({
      items: ["Learn Qwik", "Build Qwik app", "Profit"],
    }),
  );

  return <Items />;
});

// Example of retrieving the context provided by a parent component.
export const Items = component$(() => {
  const todos = useContext(TodosContext);
  return (
    <ul>
      {todos.items.map((item) => (
        <li>{item}</li>
      ))}
    </ul>
  );
});
```

```typescript
createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| name | string | The name of the context. |

**Returns:**

[ContextId](#contextid)&lt;STATE&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-context.ts)

## createSerializer$

Create a signal that holds a custom serializable value. See [useSerializer$](#useserializer_) for more details.

```typescript
createSerializer$: <T, S>(arg: SerializerArg<T, S>) => T extends Promise<any> ? never : SerializerSignal<T>
```

| Parameter | Type | Description |
| --- | --- | --- |
| arg | SerializerArg<T, S> |  |

**Returns:**

T extends Promise&lt;any&gt; ? never : SerializerSignal&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/signal.public.ts)

## createSignal

Creates a Signal with the given value. If no value is given, the signal is created with `undefined`.

```typescript
createSignal: {
    <T>(): Signal<T | undefined>;
    <T>(value: T): Signal<T>;
}
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/signal.public.ts)

## CSSProperties

```typescript
export interface CSSProperties extends CSS.Properties<string | number>, CSS.PropertiesHyphen<string | number>
```

**Extends:** CSS.Properties&lt;string \| number&gt;, CSS.PropertiesHyphen&lt;string \| number&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## DevJSX

```typescript
export interface DevJSX
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| columnNumber |  | number |  |
| fileName |  | string |  |
| lineNumber |  | number |  |
| stack? |  | string | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-node.ts)

## DOMAttributes

The Qwik-specific attributes that DOM elements accept

```typescript
export interface DOMAttributes<EL extends Element> extends DOMAttributesBase<EL>, QwikEvents<EL>
```

**Extends:** DOMAttributesBase&lt;EL&gt;, QwikEvents&lt;EL&gt;

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| class? |  | [ClassList](#classlist) \\| [Signal](#signal)<[ClassList](#classlist)> \\| undefined | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## Each

```typescript
Each: EachComponent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/control-flow/each.ts)

## Element

```typescript
type Element = JSXOutput;
```

**References:** [JSXOutput](#jsxoutput)

## ElementChildrenAttribute

```typescript
interface ElementChildrenAttribute
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| children |  | [JSXChildren](#jsxchildren) |  |

## ElementType

```typescript
type ElementType = string | FunctionComponent<Record<any, any>>;
```

**References:** [FunctionComponent](#functioncomponent)

## ErrorBoundary

Renders `fallback$` instead of its children when a descendant throws.

```typescript
ErrorBoundary: Component<ErrorBoundaryProps>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/error/error-boundary.ts)

## ErrorBoundaryInfo

Structured metadata about a caught error, passed to `onError$`.

```typescript
export interface ErrorBoundaryInfo
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| boundaryId |  | string | Identifies the boundary within the page. Allocated in render order and kept across a resume, so every report from one boundary shares it — but it shifts when render order changes. |
| digest |  | string | The code a production fallback shows for a server-origin error, so a user's bug report matches your logs. An error caught during SSR reports a second, different digest if the client re-derives it — the stacks differ. |
| phase |  | [ErrorBoundaryPhase](#errorboundaryphase) | Where the caught error originated. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/error/error-handling.ts)

## ErrorBoundaryPhase

Identifies where an error caught by an error boundary originated.

```typescript
export declare const enum ErrorBoundaryPhase
```

| Member | Value | Description |
| --- | --- | --- |
| Event | `"event"` |  |
| Hook | `"hook"` |  |
| Render | `"render"` |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/error/error-boundary-phase.ts)

## ErrorBoundaryProps

```typescript
export interface ErrorBoundaryProps
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| fallback$ |  | [QRL](#qrl-type-alias)<(error: Error & \{ digest?: string; }, reset: [QRL](#qrl-type-alias)<() => void>) => [JSXOutput](#jsxoutput)> | Rendered when a descendant throws. The error is always an `Error`, so `{error.message}` is safe: a non-Error throw is wrapped, and production redacts server-origin errors to a generic message plus `digest`. Client-origin errors render as thrown — their messages already live in the browser bundle. Wrap `reset` in a handler — `onClick$={() => reset()}`, not `onClick$={reset}` — so it stays wired in a streamed fallback. |
| onError$? |  | [QRL](#qrl-type-alias)<(error: Error, info: [ErrorBoundaryInfo](#errorboundaryinfo)) => void> | _(Optional)_ Side effect only; never affects rendering. Receives the original `Error` — a non-Error throw arrives wrapped, with `cause` set to the raw value. An error caught during SSR fires again when the client re-derives it, so dedupe in your reporter. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/error/error-boundary.ts)

## Event

## event$

```typescript
event$: <T>(qrl: T) => import("./qrl.public").QRL<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| qrl | T |  |

**Returns:**

import("./qrl.public").[QRL](#qrl-type-alias)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/qrl.public.dollar.ts)

## EventHandler

A DOM event handler

```typescript
export type EventHandler<EV = Event, EL = Element> = {
  bivarianceHack(event: EV, element: EL): any;
}["bivarianceHack"];
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## force

> Warning: This API is now obsolete.
>
> Use `trigger()` instead

```typescript
force(): void;
```

**Returns:**

void

## forceStoreEffects

Force a store to recompute and schedule effects.

```typescript
forceStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => void
```

| Parameter | Type | Description |
| --- | --- | --- |
| value | StoreTarget |  |
| prop | keyof StoreTarget |  |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/impl/store.ts)

## Fragment

```typescript
Fragment: FunctionComponent<{
  children?: any;
  key?: string | number | null;
}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/jsx-runtime.ts)

## FunctionComponent

Any function taking a props object that returns JSXOutput.

The `key`, `flags` and `dev` parameters are for internal use.

```typescript
export type FunctionComponent<P = unknown> = {
  renderFn(
    props: P,
    key: string | null,
    flags: number,
    dev?: DevJSX,
  ): JSXOutput;
}["renderFn"];
```

**References:** [DevJSX](#devjsx), [JSXOutput](#jsxoutput)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-node.ts)

## getClientManifest

Returns the client build manifest, which includes the mappings from symbols to bundles, the bundlegraph etc.

```typescript
getClientManifest: () => ServerQwikManifest | undefined;
```

**Returns:**

ServerQwikManifest \| undefined

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/get-client-manifest.ts)

## getDomContainer

```typescript
export declare function getDomContainer(element: Element): IClientContainer;
```

| Parameter | Type | Description |
| --- | --- | --- |
| element | Element |  |

**Returns:**

IClientContainer

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/client/dom-container.ts)

## getLocale

Retrieve the current locale.

If no current locale and there is no `defaultLocale` the function throws an error.

```typescript
export declare function getLocale(defaultLocale?: string): string;
```

| Parameter | Type | Description |
| --- | --- | --- |
| defaultLocale | string | _(Optional)_ |

**Returns:**

string

The locale.

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-locale.ts)

## getPlatform

Retrieve the `CorePlatform`.

The `CorePlatform` is also responsible for retrieving the Manifest, that contains mappings from symbols to javascript import chunks. For this reason, `CorePlatform` can't be global, but is specific to the application currently running. On server it is possible that many different applications are running in a single server instance, and for this reason the `CorePlatform` is associated with the application document.

```typescript
getPlatform: () => CorePlatform;
```

**Returns:**

[CorePlatform](#coreplatform)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/platform/platform.ts)

## h

The legacy transform, used by some JSX transpilers. The optimizer normally replaces this with optimized calls, with the same caveat as `jsx()`.

```typescript
export declare function h<
  TYPE extends string | FunctionComponent<PROPS>,
  PROPS extends {} = {},
>(type: TYPE, props?: PROPS | null, ...children: any[]): JSXNode<TYPE>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| type | TYPE |  |
| props | PROPS \\| null | _(Optional)_ |
| children | any[] |  |

**Returns:**

[JSXNode](#jsxnode)&lt;TYPE&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/jsx-runtime.ts)

## Hook

## HTMLElementAttrs

```typescript
export interface HTMLElementAttrs extends HTMLAttributesBase, FilterBase<HTMLElement>
```

**Extends:** HTMLAttributesBase, FilterBase&lt;HTMLElement&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## implicit$FirstArg

Create a `____$(...)` convenience method from `___(...)`.

It is very common for functions to take a lazy-loadable resource as a first argument. For this reason, the Qwik Optimizer automatically extracts the first argument from any function which ends in `$`.

This means that `foo$(arg0)` and `foo($(arg0))` are equivalent with respect to Qwik Optimizer. The former is just a shorthand for the latter.

For example, these function calls are equivalent:

- `component$(() => {...})` is same as `component($(() => {...}))`

```tsx
export function myApi(callback: QRL<() => void>): void {
  // ...
}

export const myApi$ = implicit$FirstArg(myApi);
// type of myApi$: (callback: () => void): void

// can be used as:
myApi$(() => console.log("callback"));

// will be transpiled to:
// FILE: <current file>
myApi(qrl("./chunk-abc.js", "callback"));

// FILE: chunk-abc.js
export const callback = () => console.log("callback");
```

```typescript
implicit$FirstArg: <FIRST, REST extends any[], RET>(
    fn: (qrl: QRL<FIRST>, ...rest: REST) => RET,
  ) =>
  (qrl: FIRST, ...rest: REST) =>
    RET;
```

| Parameter | Type | Description |
| --- | --- | --- |
| fn | (qrl: [QRL](#qrl-type-alias)<FIRST>, ...rest: REST) => RET | A function that should have its first argument automatically `$`. |

**Returns:**

((qrl: FIRST, ...rest: REST) =&gt; RET)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/implicit_dollar.ts)

## inlinedQrl

Create an inlined QRL. This is mostly useful on the server side for serialization.

```typescript
inlinedQrl: <T>(
  symbol: T | null,
  symbolName: string,
  lexicalScopeCapture?: Readonly<unknown[]>,
) => QRL<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| symbol | T \\| null | The object/function to register, or `null` to retrieve a previously registered one by hash |
| symbolName | string | The name of the symbol. |
| lexicalScopeCapture | Readonly<unknown[]> | _(Optional)_ A set of lexically scoped variables to capture. |

**Returns:**

[QRL](#qrl-type-alias)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/qrl.ts)

## IntrinsicAttributes

```typescript
interface IntrinsicAttributes extends QwikIntrinsicAttributes
```

**Extends:** QwikIntrinsicAttributes

## IntrinsicElements

```typescript
interface IntrinsicElements extends LenientQwikElements
```

**Extends:** LenientQwikElements

## invalidate

Use this to force recalculation.

```typescript
invalidate(): void;
```

**Returns:**

void

## isSignal

```typescript
isSignal: (value: any) => value is Signal<unknown>
```

| Parameter | Type | Description |
| --- | --- | --- |
| value | any |  |

**Returns:**

value is [Signal](#signal)&lt;unknown&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/utils.ts)

## jsx

Used by the JSX transpilers to create a JSXNode. Note that the optimizer will normally not use this, instead using \_jsxSplit and \_jsxSorted directly.

The optimizer will also replace all `jsx()` calls with the more optimized versions.

The exception is when the props are not a literal object, which can only happen when the `jsx` call is written directly.

```typescript
jsx: <T extends string | FunctionComponent<any>>(
  type: T,
  props: T extends FunctionComponent<infer PROPS> ? PROPS : Props,
  key?: string | number | null,
  _isStatic?: boolean,
  dev?: JsxDevOpts,
) => JSXNode<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| type | T |  |
| props | T extends [FunctionComponent](#functioncomponent)<infer PROPS> ? PROPS : Props |  |
| key | string \\| number \\| null | _(Optional)_ |
| \_isStatic | boolean | _(Optional)_ |
| dev | JsxDevOpts | _(Optional)_ |

**Returns:**

[JSXNode](#jsxnode)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/jsx-runtime.ts)

## JSXChildren

```typescript
export type JSXChildren =
  | string
  | number
  | boolean
  | null
  | undefined
  | Function
  | RegExp
  | JSXChildren[]
  | Promise<JSXChildren>
  | Signal<JSXChildren>
  | JSXNode;
```

**References:** [JSXChildren](#jsxchildren), [Signal](#signal), [JSXNode](#jsxnode)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## jsxDEV

Alias of `jsx` for development purposes.

```typescript
jsxDEV: <T extends string | FunctionComponent<any>>(
  type: T,
  props: T extends FunctionComponent<infer PROPS> ? PROPS : Props,
  key?: string | number | null,
  _isStatic?: boolean,
  dev?: JsxDevOpts,
) => JSXNode<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| type | T |  |
| props | T extends [FunctionComponent](#functioncomponent)<infer PROPS> ? PROPS : Props |  |
| key | string \\| number \\| null | _(Optional)_ |
| \_isStatic | boolean | _(Optional)_ |
| dev | JsxDevOpts | _(Optional)_ |

**Returns:**

[JSXNode](#jsxnode)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/jsx-runtime.ts)

## JSXNode

A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.

```typescript
export interface JSXNode<T extends string | FunctionComponent | unknown = unknown>
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| children |  | [JSXChildren](#jsxchildren) \\| null |  |
| dev? |  | [DevJSX](#devjsx) | _(Optional)_ |
| key |  | string \\| null |  |
| props |  | T extends [FunctionComponent](#functioncomponent)<infer P> ? P : Record<any, unknown> |  |
| type |  | T |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-node.ts)

## JSXOutput

Any valid output for a component

```typescript
export type JSXOutput =
  | JSXNode
  | string
  | number
  | boolean
  | null
  | undefined
  | JSXOutput[];
```

**References:** [JSXNode](#jsxnode), [JSXOutput](#jsxoutput)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-node.ts)

## jsxs

Alias of `jsx` to support JSX syntax.

```typescript
jsxs: <T extends string | FunctionComponent<any>>(
  type: T,
  props: T extends FunctionComponent<infer PROPS> ? PROPS : Props,
  key?: string | number | null,
  _isStatic?: boolean,
  dev?: JsxDevOpts,
) => JSXNode<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| type | T |  |
| props | T extends [FunctionComponent](#functioncomponent)<infer PROPS> ? PROPS : Props |  |
| key | string \\| number \\| null | _(Optional)_ |
| \_isStatic | boolean | _(Optional)_ |
| dev | JsxDevOpts | _(Optional)_ |

**Returns:**

[JSXNode](#jsxnode)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/jsx-runtime.ts)

## JSXTagName

```typescript
export type JSXTagName =
  | keyof HTMLElementTagNameMap
  | Omit<string, keyof HTMLElementTagNameMap>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## KnownEventNames

The names of events that Qwik knows about. They are all lowercase, but on the JSX side, they are PascalCase for nicer DX. (`onAuxClick$` vs `onauxclick$`)

```typescript
export type KnownEventNames = LiteralUnion<AllEventKeys, string>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeAnimationEvent

> Warning: This API is now obsolete.
>
> Use `AnimationEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeAnimationEvent = AnimationEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeClipboardEvent

> Warning: This API is now obsolete.
>
> Use `ClipboardEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeClipboardEvent = ClipboardEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeCompositionEvent

> Warning: This API is now obsolete.
>
> Use `CompositionEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeCompositionEvent = CompositionEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeDragEvent

> Warning: This API is now obsolete.
>
> Use `DragEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeDragEvent = DragEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeFocusEvent

> Warning: This API is now obsolete.
>
> Use `FocusEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeFocusEvent = FocusEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeKeyboardEvent

> Warning: This API is now obsolete.
>
> Use `KeyboardEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeKeyboardEvent = KeyboardEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeMouseEvent

> Warning: This API is now obsolete.
>
> Use `MouseEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeMouseEvent = MouseEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativePointerEvent

> Warning: This API is now obsolete.
>
> Use `PointerEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativePointerEvent = PointerEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeTouchEvent

> Warning: This API is now obsolete.
>
> Use `TouchEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeTouchEvent = TouchEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeTransitionEvent

> Warning: This API is now obsolete.
>
> Use `TransitionEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeTransitionEvent = TransitionEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeUIEvent

> Warning: This API is now obsolete.
>
> Use `UIEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeUIEvent = UIEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## NativeWheelEvent

> Warning: This API is now obsolete.
>
> Use `WheelEvent` and use the second argument to the handler function for the current event target

```typescript
export type NativeWheelEvent = WheelEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## noSerialize

Returned type of the `noSerialize()` function. It will be TYPE or undefined.

```typescript
export type NoSerialize<T> =
  | (T & {
      __no_serialize__: true;
    })
  | undefined;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/serdes/verify.ts)

## NoSerialize

Returned type of the `noSerialize()` function. It will be TYPE or undefined.

```typescript
export type NoSerialize<T> =
  | (T & {
      __no_serialize__: true;
    })
  | undefined;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/serdes/verify.ts)

## NoSerializeSymbol

If an object has this property, it will not be serialized. Use this on prototypes to avoid having to call `noSerialize()` on every object.

```typescript
NoSerializeSymbol: unique symbol
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/serdes/verify.ts)

## OnRenderFn

```typescript
export type OnRenderFn<PROPS> = (props: PROPS) => JSXOutput;
```

**References:** [JSXOutput](#jsxoutput)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/component.public.ts)

## OnVisibleTaskOptions

```typescript
export interface OnVisibleTaskOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| strategy? |  | [VisibleTaskStrategy](#visibletaskstrategy) | _(Optional)_ The strategy to use to determine when the "VisibleTask" should first execute. - `intersection-observer`: the task will first execute when the element is visible in the viewport, under the hood it uses the IntersectionObserver API. - `document-ready`: the task will first execute when the document is ready, under the hood it uses the document `load` event. - `document-idle`: the task will first execute when the document is idle, under the hood it uses the requestIdleCallback API. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-visible-task.ts)

## PrefetchGraph

> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

> Warning: This API is now obsolete.
>
> This is no longer needed as the preloading happens automatically in qrl-class. You can remove this component from your app.

```typescript
PrefetchGraph: (_opts?: {
  base?: string;
  manifestHash?: string;
  manifestURL?: string;
  nonce?: string;
}) => JSXOutput;
```

| Parameter | Type | Description |
| --- | --- | --- |
| \_opts | \{ base?: string; manifestHash?: string; manifestURL?: string; nonce?: string; } | _(Optional)_ |

**Returns:**

[JSXOutput](#jsxoutput)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/prefetch-service-worker/prefetch.ts)

## PrefetchServiceWorker

> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

> Warning: This API is now obsolete.
>
> This is no longer needed as the preloading happens automatically in qrl-class.ts. Leave this in your app for a while so it uninstalls existing service workers, but don't use it for new projects.

```typescript
PrefetchServiceWorker: (opts: {
  base?: string;
  scope?: string;
  path?: string;
  verbose?: boolean;
  fetchBundleGraph?: boolean;
  nonce?: string;
}) => JSXOutput;
```

| Parameter | Type | Description |
| --- | --- | --- |
| opts | \{ base?: string; scope?: string; path?: string; verbose?: boolean; fetchBundleGraph?: boolean; nonce?: string; } |  |

**Returns:**

[JSXOutput](#jsxoutput)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/prefetch-service-worker/prefetch.ts)

## promise

A promise that resolves when the value is computed or rejected.

```typescript
promise(): Promise<void>;
```

**Returns:**

Promise&lt;void&gt;

## PropFunction

Alias for `QRL<T>`. Of historic relevance only.

```typescript
export type PropFunction<T> = QRL<T>;
```

**References:** [QRL](#qrl-type-alias)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/qrl.public.ts)

## PropsOf

Infers `Props` from the component or tag.

```typescript
export type PropsOf<COMP> = COMP extends string
  ? COMP extends keyof QwikIntrinsicElements
    ? QwikIntrinsicElements[COMP]
    : QwikIntrinsicElements["span"]
  : NonNullable<COMP> extends never
    ? never
    : COMP extends FunctionComponent<infer PROPS>
      ? PROPS extends Record<any, infer V>
        ? IsAny<V> extends true
          ? never
          : ObjectProps<PROPS>
        : COMP extends Component<infer OrigProps>
          ? ObjectProps<OrigProps>
          : PROPS
      : never;
```

**References:** [QwikIntrinsicElements](#qwikintrinsicelements), [FunctionComponent](#functioncomponent), [Component](#component)

```tsx
const Desc = component$(
  ({ desc, ...props }: { desc: string } & PropsOf<"div">) => {
    return <div {...props}>{desc}</div>;
  },
);

const TitleBox = component$(
  ({ title, ...props }: { title: string } & PropsOf<Box>) => {
    return (
      <Box {...props}>
        <h1>{title}</h1>
      </Box>
    );
  },
);
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/component.public.ts)

## PublicProps

Extends the defined component PROPS, adding the default ones (children and q:slot) and allowing plain functions to QRL arguments.

```typescript
export type PublicProps<PROPS> = (PROPS extends Record<any, any>
  ? Omit<PROPS, `${string}$`> & _Only$<PROPS>
  : unknown extends PROPS
    ? {}
    : PROPS) &
  ComponentBaseProps &
  ComponentChildren<PROPS>;
```

**References:** [ComponentBaseProps](#componentbaseprops)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/component.public.ts)

## qrl

The `QRL` type represents a lazy-loadable AND serializable resource.

QRL stands for Qwik URL.

Use `QRL` when you want to refer to a lazy-loaded resource. `QRL`s are most often used for code (functions) but can also be used for other resources such as `string`s in the case of styles.

`QRL` is an opaque token that is generated by the Qwik Optimizer. (Do not rely on any properties in `QRL` as it may change between versions.)

\#\# Creating `QRL` references

Creating `QRL` is done using `$(...)` function. `$(...)` is a special marker for the Qwik Optimizer that marks that the code should be extracted into a lazy-loaded symbol.

```tsx
useOnDocument(
  "mousemove",
  $((event) => console.log("mousemove", event)),
);
```

In the above code, the Qwik Optimizer detects `$(...)` and transforms the code as shown below:

```tsx
// FILE: <current file>
useOnDocument("mousemove", qrl("./chunk-abc.js", "onMousemove"));

// FILE: chunk-abc.js
export const onMousemove = () => console.log("mousemove");
```

NOTE: `qrl(...)` is a result of Qwik Optimizer transformation. You should never have to invoke this function directly in your application. The `qrl(...)` function should be invoked only after the Qwik Optimizer transformation.

\#\# Using `QRL`s

Use `QRL` type in your application when you want to get a lazy-loadable reference to a resource (most likely a function).

```tsx
// Example of declaring a custom functions which takes callback as QRL.
export function useMyFunction(callback: QRL<() => void>) {
  doExtraStuff();
  // The callback passed to `onDocument` requires `QRL`.
  useOnDocument("mousemove", callback);
}
```

In the above example, the way to think about the code is that you are not asking for a callback function but rather a reference to a lazy-loadable callback function. Specifically, the function loading should be delayed until it is actually needed. In the above example, the function would not load until after a `mousemove` event on `document` fires.

\#\# Resolving `QRL` references

At times it may be necessary to resolve a `QRL` reference to the actual value. This can be performed using `QRL.resolve(..)` function.

```tsx
// Assume you have QRL reference to a greet function
const lazyGreet: QRL<() => void> = $(() => console.log("Hello World!"));

// Use `qrlImport` to load / resolve the reference.
const greet: () => void = await lazyGreet.resolve();

//  Invoke it
greet();
```

NOTE: `element` is needed because `QRL`s are relative and need a base location to resolve against. The base location is encoded in the HTML in the form of `<div q:base="/url">`.

\#\# `QRL.resolved`

Once `QRL.resolve()` returns, the value is stored under `QRL.resolved`. This allows the value to be used without having to await `QRL.resolve()` again.

\#\# Question: Why not just use `import()`?

At first glance, `QRL` serves the same purpose as `import()`. However, there are three subtle differences that need to be taken into account.

1. `QRL`s must be serializable into HTML. 2. `QRL`s must be resolved by framework relative to `q:base`. 3. `QRL`s must be able to capture lexically scoped variables. 4. `QRL`s encapsulate the difference between running with and without Qwik Optimizer. 5. `QRL`s allow expressing lazy-loaded boundaries without thinking about chunk and symbol names.

Let's assume that you intend to write code such as this:

```tsx
return <button onClick={() => (await import('./chunk-abc.js')).onClick}>
```

The above code needs to be serialized into DOM such as:

```
<div q:base="/build/">
  <button q-e:click="./chunk-abc.js#onClick">...</button>
</div>
```

1. Notice there is no easy way to extract chunk (`./chunk-abc.js`) and symbol (`onClick`) into HTML. 2. Notice that even if you could extract it, the `import('./chunk-abc.js')` would become relative to where the `import()` file is declared. Because it is our framework doing the load, the `./chunk-abc.js` would become relative to the framework file. This is not correct, as it should be relative to the original file generated by the bundler. 3. Next, the framework needs to resolve the `./chunk-abc.js` and needs a base location that is encoded in the HTML. 4. The QRL needs to be able to capture lexically scoped variables. (`import()` only allows loading top-level symbols which don't capture variables.) 5. As a developer, you don't want to think about `import` and naming the chunks and symbols. You just want to say: "this should be lazy."

These are the main reasons why Qwik introduces its own concept of `QRL`.

```typescript
export type QRL<TYPE = unknown> = {
  __qwik_serializable__?: any;
  __brand__QRL__?: TYPE;
  resolve(): Promise<TYPE>;
  resolved: undefined | TYPE;
  getCaptured(): unknown[] | null;
  getSymbol(): string;
  getHash(): string;
  dev?: QRLDev | null;
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/qrl.ts)

## QRL

The `QRL` type represents a lazy-loadable AND serializable resource.

QRL stands for Qwik URL.

Use `QRL` when you want to refer to a lazy-loaded resource. `QRL`s are most often used for code (functions) but can also be used for other resources such as `string`s in the case of styles.

`QRL` is an opaque token that is generated by the Qwik Optimizer. (Do not rely on any properties in `QRL` as it may change between versions.)

\#\# Creating `QRL` references

Creating `QRL` is done using `$(...)` function. `$(...)` is a special marker for the Qwik Optimizer that marks that the code should be extracted into a lazy-loaded symbol.

```tsx
useOnDocument(
  "mousemove",
  $((event) => console.log("mousemove", event)),
);
```

In the above code, the Qwik Optimizer detects `$(...)` and transforms the code as shown below:

```tsx
// FILE: <current file>
useOnDocument("mousemove", qrl("./chunk-abc.js", "onMousemove"));

// FILE: chunk-abc.js
export const onMousemove = () => console.log("mousemove");
```

NOTE: `qrl(...)` is a result of Qwik Optimizer transformation. You should never have to invoke this function directly in your application. The `qrl(...)` function should be invoked only after the Qwik Optimizer transformation.

\#\# Using `QRL`s

Use `QRL` type in your application when you want to get a lazy-loadable reference to a resource (most likely a function).

```tsx
// Example of declaring a custom functions which takes callback as QRL.
export function useMyFunction(callback: QRL<() => void>) {
  doExtraStuff();
  // The callback passed to `onDocument` requires `QRL`.
  useOnDocument("mousemove", callback);
}
```

In the above example, the way to think about the code is that you are not asking for a callback function but rather a reference to a lazy-loadable callback function. Specifically, the function loading should be delayed until it is actually needed. In the above example, the function would not load until after a `mousemove` event on `document` fires.

\#\# Resolving `QRL` references

At times it may be necessary to resolve a `QRL` reference to the actual value. This can be performed using `QRL.resolve(..)` function.

```tsx
// Assume you have QRL reference to a greet function
const lazyGreet: QRL<() => void> = $(() => console.log("Hello World!"));

// Use `qrlImport` to load / resolve the reference.
const greet: () => void = await lazyGreet.resolve();

//  Invoke it
greet();
```

NOTE: `element` is needed because `QRL`s are relative and need a base location to resolve against. The base location is encoded in the HTML in the form of `<div q:base="/url">`.

\#\# `QRL.resolved`

Once `QRL.resolve()` returns, the value is stored under `QRL.resolved`. This allows the value to be used without having to await `QRL.resolve()` again.

\#\# Question: Why not just use `import()`?

At first glance, `QRL` serves the same purpose as `import()`. However, there are three subtle differences that need to be taken into account.

1. `QRL`s must be serializable into HTML. 2. `QRL`s must be resolved by framework relative to `q:base`. 3. `QRL`s must be able to capture lexically scoped variables. 4. `QRL`s encapsulate the difference between running with and without Qwik Optimizer. 5. `QRL`s allow expressing lazy-loaded boundaries without thinking about chunk and symbol names.

Let's assume that you intend to write code such as this:

```tsx
return <button onClick={() => (await import('./chunk-abc.js')).onClick}>
```

The above code needs to be serialized into DOM such as:

```
<div q:base="/build/">
  <button q-e:click="./chunk-abc.js#onClick">...</button>
</div>
```

1. Notice there is no easy way to extract chunk (`./chunk-abc.js`) and symbol (`onClick`) into HTML. 2. Notice that even if you could extract it, the `import('./chunk-abc.js')` would become relative to where the `import()` file is declared. Because it is our framework doing the load, the `./chunk-abc.js` would become relative to the framework file. This is not correct, as it should be relative to the original file generated by the bundler. 3. Next, the framework needs to resolve the `./chunk-abc.js` and needs a base location that is encoded in the HTML. 4. The QRL needs to be able to capture lexically scoped variables. (`import()` only allows loading top-level symbols which don't capture variables.) 5. As a developer, you don't want to think about `import` and naming the chunks and symbols. You just want to say: "this should be lazy."

These are the main reasons why Qwik introduces its own concept of `QRL`.

```typescript
export type QRL<TYPE = unknown> = {
  __qwik_serializable__?: any;
  __brand__QRL__?: TYPE;
  resolve(): Promise<TYPE>;
  resolved: undefined | TYPE;
  getCaptured(): unknown[] | null;
  getSymbol(): string;
  getHash(): string;
  dev?: QRLDev | null;
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/qrl.public.ts)

## QRLEventHandlerMulti

An event handler for Qwik events, can be a handler QRL or an array of handler QRLs.

```typescript
export type QRLEventHandlerMulti<EV extends Event, EL> =
  | QRL<EventHandler<EV, EL>>
  | undefined
  | null
  | QRLEventHandlerMulti<EV, EL>[];
```

**References:** [QRL](#qrl-type-alias), [EventHandler](#eventhandler), [QRLEventHandlerMulti](#qrleventhandlermulti)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## QwikAnimationEvent

> Warning: This API is now obsolete.
>
> Use `AnimationEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikAnimationEvent<T = Element> = NativeAnimationEvent;
```

**References:** [NativeAnimationEvent](#nativeanimationevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikAttributes

The Qwik DOM attributes without plain handlers, for use as function parameters

```typescript
export interface QwikAttributes<EL extends Element> extends DOMAttributesBase<EL>, QwikEvents<EL, false>
```

**Extends:** DOMAttributesBase&lt;EL&gt;, QwikEvents&lt;EL, false&gt;

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| class? |  | [ClassList](#classlist) \\| undefined | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-attributes.ts)

## QwikChangeEvent

> Warning: This API is now obsolete.
>
> Use `Event` and use the second argument to the handler function for the current event target. Also note that in Qwik, onInput$ with the InputEvent is the event that behaves like onChange in React.

```typescript
export type QwikChangeEvent<T = Element> = Event;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikClipboardEvent

> Warning: This API is now obsolete.
>
> Use `ClipboardEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikClipboardEvent<T = Element> = NativeClipboardEvent;
```

**References:** [NativeClipboardEvent](#nativeclipboardevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikCompositionEvent

> Warning: This API is now obsolete.
>
> Use `CompositionEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikCompositionEvent<T = Element> = NativeCompositionEvent;
```

**References:** [NativeCompositionEvent](#nativecompositionevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikDOMAttributes

```typescript
export interface QwikDOMAttributes extends DOMAttributes<Element>
```

**Extends:** [DOMAttributes](#domattributes)&lt;Element&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik.ts)

## QwikDragEvent

> Warning: This API is now obsolete.
>
> Use `DragEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikDragEvent<T = Element> = NativeDragEvent;
```

**References:** [NativeDragEvent](#nativedragevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikFocusEvent

> Warning: This API is now obsolete.
>
> Use `FocusEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikFocusEvent<T = Element> = NativeFocusEvent;
```

**References:** [NativeFocusEvent](#nativefocusevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikHTMLElements

The DOM props without plain handlers, for use inside functions

```typescript
export type QwikHTMLElements = {
  [tag in keyof HTMLElementTagNameMap]: Augmented<
    HTMLElementTagNameMap[tag],
    SpecialAttrs[tag]
  > &
    HTMLElementAttrs &
    QwikAttributes<HTMLElementTagNameMap[tag]>;
};
```

**References:** [HTMLElementAttrs](#htmlelementattrs), [QwikAttributes](#qwikattributes)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## QwikIdleEvent

Emitted by qwik-loader on document when the document first becomes idle

```typescript
export type QwikIdleEvent = CustomEvent<{}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikInitEvent

Emitted by qwik-loader on document when the document first becomes interactive

```typescript
export type QwikInitEvent = CustomEvent<{}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikIntrinsicElements

The interface holds available attributes of both native DOM elements and custom Qwik elements. An example showing how to define a customizable wrapper component:

```tsx
import { component$, Slot, type QwikIntrinsicElements } from "@qwik.dev/core";

type WrapperProps = {
  attributes?: QwikIntrinsicElements["div"];
};

export default component$<WrapperProps>(({ attributes }) => {
  return (
    <div {...attributes} class="p-2">
      <Slot />
    </div>
  );
});
```

Note: It is shorter to use `PropsOf<'div'>`

```typescript
export interface QwikIntrinsicElements extends QwikHTMLElements, QwikSVGElements
```

**Extends:** [QwikHTMLElements](#qwikhtmlelements), [QwikSVGElements](#qwiksvgelements)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-elements.ts)

## QwikInvalidEvent

> Warning: This API is now obsolete.
>
> Use `Event` and use the second argument to the handler function for the current event target

```typescript
export type QwikInvalidEvent<T = Element> = Event;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikJSX

```typescript
export declare namespace QwikJSX
```

| Interface | Description |
| --- | --- |
| [ElementChildrenAttribute](#qwikjsx-elementchildrenattribute) |  |
| [IntrinsicAttributes](#qwikjsx-intrinsicattributes) |  |
| [IntrinsicElements](#qwikjsx-intrinsicelements) |  |

| Type Alias | Description |
| --- | --- |
| [Element](#qwikjsx-element) |  |
| [ElementType](#qwikjsx-elementtype) |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik.ts)

## QwikKeyboardEvent

> Warning: This API is now obsolete.
>
> Use `KeyboardEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikKeyboardEvent<T = Element> = NativeKeyboardEvent;
```

**References:** [NativeKeyboardEvent](#nativekeyboardevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikMouseEvent

> Warning: This API is now obsolete.
>
> Use `MouseEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikMouseEvent<T = Element, E = NativeMouseEvent> = E;
```

**References:** [NativeMouseEvent](#nativemouseevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikPointerEvent

> Warning: This API is now obsolete.
>
> Use `PointerEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikPointerEvent<T = Element> = NativePointerEvent;
```

**References:** [NativePointerEvent](#nativepointerevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikResumeEvent

Emitted by qwik-core on the container element when it resumes from a paused state. You cannot put a Qwik event handler on the container so you must listen on the document instead.

```typescript
export type QwikResumeEvent = CustomEvent<{}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikSubmitEvent

> Warning: This API is now obsolete.
>
> Use `SubmitEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikSubmitEvent<T = Element> = SubmitEvent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikSVGElements

The SVG props without plain handlers, for use inside functions

```typescript
export type QwikSVGElements = {
  [K in keyof Omit<
    SVGElementTagNameMap,
    keyof HTMLElementTagNameMap
  >]: SVGProps<SVGElementTagNameMap[K]>;
};
```

**References:** [SVGProps](#svgprops)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## QwikSymbolEvent

Emitted by qwik-loader on document when a module was lazily loaded

```typescript
export type QwikSymbolEvent = CustomEvent<{
  symbol: string;
  element: Element;
  reqTime: number;
  qBase?: string;
  href?: string;
}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikTouchEvent

> Warning: This API is now obsolete.
>
> Use `TouchEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikTouchEvent<T = Element> = NativeTouchEvent;
```

**References:** [NativeTouchEvent](#nativetouchevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikTransitionEvent

> Warning: This API is now obsolete.
>
> Use `TransitionEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikTransitionEvent<T = Element> = NativeTransitionEvent;
```

**References:** [NativeTransitionEvent](#nativetransitionevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikUIEvent

> Warning: This API is now obsolete.
>
> Use `UIEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikUIEvent<T = Element> = NativeUIEvent;
```

**References:** [NativeUIEvent](#nativeuievent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikViewTransitionEvent

Emitted by qwik-core on document when the a view transition start

```typescript
export type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikVisibleEvent

Handled by qwik-loader when an element becomes visible. Used by `useVisibleTask$`. Does not bubble.

```typescript
export type QwikVisibleEvent = CustomEvent<IntersectionObserverEntry>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## QwikWheelEvent

> Warning: This API is now obsolete.
>
> Use `WheelEvent` and use the second argument to the handler function for the current event target

```typescript
export type QwikWheelEvent<T = Element> = NativeWheelEvent;
```

**References:** [NativeWheelEvent](#nativewheelevent)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-qwik-events.ts)

## ReadonlySignal

> Warning: This API is now obsolete.
>
> Use `Readonly<Signal<T>>` instead.

```typescript
export interface ReadonlySignal<T = unknown>
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| value | `readonly` | T |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/signal.public.ts)

## render

Render JSX.

Use this method to render JSX. This function does reconciling which means it always tries to reuse what is already in the DOM (rather then destroy and recreate content.) It returns a cleanup function you could use for cleaning up subscriptions.

```typescript
render: (
  parent: Element | Document,
  jsxNode: JSXOutput | FunctionComponent<any>,
  opts?: RenderOptions,
) => Promise<RenderResult>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| parent | Element \\| Document | Element which will act as a parent to `jsxNode`. When possible the rendering will try to reuse existing nodes. |
| jsxNode | [JSXOutput](#jsxoutput) \\| [FunctionComponent](#functioncomponent)<any> | JSX to render |
| opts | [RenderOptions](#renderoptions) | _(Optional)_ |

**Returns:**

Promise&lt;[RenderResult](#renderresult)&gt;

An object containing a cleanup function.

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/client/dom-render.ts)

## Render

## RenderOnce

```typescript
RenderOnce: FunctionComponent<{
  children?: unknown;
  key?: string | number | null | undefined;
}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/jsx-runtime.ts)

## RenderOptions

```typescript
export interface RenderOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| serverData? |  | Record<string, any> | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/client/types.ts)

## RenderResult

```typescript
export interface RenderResult
```

| Method | Description |
| --- | --- |
| [cleanup()](#renderresult-cleanup) |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/client/types.ts)

## RenderSSROptions

```typescript
export interface RenderSSROptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| base? |  | string | _(Optional)_ |
| containerAttributes |  | Record<string, string> |  |
| containerTagName |  | string |  |
| manifestHash |  | string |  |
| serverData? |  | Record<string, any> | _(Optional)_ |
| stream |  | StreamWriter |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/ssr/ssr-types.ts)

## Resource

> Warning: This API is now obsolete.
>
> Use `useComputed$` instead. Read the `pending` and `error` properties from the returned signal to determine the status.

```tsx
const Cmp = component$(() => {
  const city = useSignal("");

  const weather = useComputed$(async ({ track, cleanup, abortSignal }) => {
    const cityName = track(city);
    const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
      signal: abortSignal,
    });
    const temp = (await res.json()) as { temp: number };
    return temp;
  });

  return (
    <div>
      <input name="city" bind:value={city} />
      <div>
        Temperature:{" "}
        {weather.pending
          ? "Loading..."
          : weather.error
            ? `Error: ${weather.error.message}`
            : weather.value.temp}
      </div>
    </div>
  );
});
```

```typescript
Resource: <T>(input: ResourceProps<T>) => JSXOutput;
```

| Parameter | Type | Description |
| --- | --- | --- |
| \{ value, onResolved, onPending, onRejected, } | (not declared) |  |
| input | [ResourceProps](#resourceprops)<T> |  |

**Returns:**

[JSXOutput](#jsxoutput)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## ResourceCtx

```typescript
export interface ResourceCtx<T = unknown> extends ComputeCtx<T>
```

**Extends:** ComputeCtx&lt;T&gt;

| Method | Description |
| --- | --- |
| [cache(policyOrMilliseconds)](#resourcectx-cache) |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## ResourceFn

```typescript
export type ResourceFn<T> = (ctx: ResourceCtx) => ValueOrPromise<T>;
```

**References:** [ResourceCtx](#resourcectx), [ValueOrPromise](#valueorpromise)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## ResourceOptions

Options to pass to `useResource$()`

```typescript
export interface ResourceOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| timeout? |  | number | _(Optional)_ Timeout in milliseconds. If the resource takes more than the specified millisecond, it will timeout. Resulting on a rejected resource. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## ResourcePending

```typescript
export type ResourcePending<T> = ResourceReturn<T>;
```

**References:** [ResourceReturn](#resourcereturn)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## ResourceProps

```typescript
export interface ResourceProps<T>
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| onPending? |  | () => [JSXOutput](#jsxoutput) \\| Promise<[JSXOutput](#jsxoutput)> | _(Optional)_ |
| onRejected? |  | (reason: Error) => [JSXOutput](#jsxoutput) \\| Promise<[JSXOutput](#jsxoutput)> | _(Optional)_ |
| onResolved |  | (value: T) => [JSXOutput](#jsxoutput) \\| Promise<[JSXOutput](#jsxoutput)> |  |
| value | `readonly` | [ResourceReturn](#resourcereturn)<T> \\| [Signal](#signal)<Promise<T> \\| T> \\| Promise<T> |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## ResourceRejected

```typescript
export type ResourceRejected<T> = ResourceReturn<T>;
```

**References:** [ResourceReturn](#resourcereturn)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## ResourceResolved

```typescript
export type ResourceResolved<T> = ResourceReturn<T>;
```

**References:** [ResourceReturn](#resourcereturn)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## ResourceReturn

```typescript
export type ResourceReturn<T> = {
  readonly value: Promise<T>;
  readonly loading: boolean;
};
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource.ts)

## Reveal

```typescript
Reveal: typeof revealCmp;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/control-flow/reveal.tsx)

## RevealOrder

```typescript
export type RevealOrder = "parallel" | "sequential" | "reverse" | "together";
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/utils/reveal.ts)

## RevealProps

```typescript
export type RevealProps = {
  order?: RevealOrder;
  collapsed?: boolean;
};
```

**References:** [RevealOrder](#revealorder)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/control-flow/reveal.tsx)

## SerializationStrategy

Serialization strategy for computed and async signals. This determines whether to serialize their value during SSR.

- `never`: The value is never serialized. When the component is resumed, the value will be recalculated when it is first read. - `always`: The value is always serialized. This is the default.

\*\*IMPORTANT\*\*: When you use `never`, your serialized HTML is smaller, but the recalculation will trigger subscriptions, meaning that other signals using this signal will recalculate, even if this signal didn't change.

This is normally not a problem, but for async signals it may mean fetching something again.

```typescript
export type SerializationStrategy = "never" | "always";
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/types.ts)

## SerializerSymbol

If an object has this property as a function, it will be called with the object and should return a serializable value.

This can be used to clean up, integrate with other libraries, etc.

The type your object should conform to is:

```ts
{
  [SerializerSymbol]: (this: YourType, toSerialize: YourType) => YourSerializableType;
}
```

```typescript
SerializerSymbol: unique symbol
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/serdes/verify.ts)

## setPlatform

Sets the `CorePlatform`.

This is useful to override the platform in tests to change the behavior of, `requestAnimationFrame`, and import resolution.

```typescript
setPlatform: (plt: CorePlatform) => CorePlatform;
```

| Parameter | Type | Description |
| --- | --- | --- |
| plt | [CorePlatform](#coreplatform) |  |

**Returns:**

[CorePlatform](#coreplatform)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/platform/platform.ts)

## Show

```typescript
Show: ShowComponent;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/control-flow/show.ts)

## ShowComponent

```typescript
export type ShowComponent = <
  WHEN = unknown,
  THEN extends JSXOutput = JSXOutput,
  ELSE extends JSXOutput = JSXOutput,
>(
  props: PublicProps<ShowProps<WHEN, THEN, ELSE>>,
  key: string | null,
  flags: number,
  dev?: DevJSX,
) => JSXOutput;
```

**References:** [JSXOutput](#jsxoutput), [PublicProps](#publicprops), [ShowProps](#showprops), [DevJSX](#devjsx)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/control-flow/show.ts)

## ShowProps

```typescript
export interface ShowProps<WHEN = unknown, THEN extends JSXOutput = JSXOutput, ELSE extends JSXOutput = JSXOutput>
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| else$? |  | [QRL](#qrl-type-alias)<(when: WHEN) => ELSE> | _(Optional)_ |
| then$ |  | [QRL](#qrl-type-alias)<(when: WHEN) => THEN> |  |
| when$ |  | [QRL](#qrl-type-alias)<() => WHEN> |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/control-flow/show.ts)

## Signal

A signal is a reactive value which can be read and written. When the signal is written, all tasks which are tracking the signal will be re-run and all components that read the signal will be re-rendered.

Furthermore, when a signal value is passed as a prop to a component, the optimizer will automatically forward the signal. This means that `return <div title={signal.value}>hi</div>` will update the `title` attribute when the signal changes without having to re-render the component.

```typescript
export interface Signal<T = any>
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| untrackedValue |  | T | Reading from this does not subscribe to updates; writing to this does not trigger updates. |
| value |  | T | Reading from this subscribes to updates; writing to this triggers updates. |

| Method | Description |
| --- | --- |
| [trigger()](#signal-trigger) | Use this to trigger running subscribers, for example when the value mutated but remained the same object. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/signal.public.ts)

## SkipRender

```typescript
SkipRender: JSXNode;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## Slot

Allows to project the children of the current component. `<Slot/>` can only be used within the context of a component defined with `component$`.

```typescript
Slot: FunctionComponent<{
  name?: string;
  children?: JSXChildren;
}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/slot.public.ts)

## SnapshotListener

```typescript
export interface SnapshotListener
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| el |  | Element |  |
| key |  | string |  |
| qrl |  | [QRL](#qrl-type-alias)<any> |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/ssr/ssr-types.ts)

## SnapshotMeta

```typescript
export type SnapshotMeta = Record<string, SnapshotMetaValue>;
```

**References:** [SnapshotMetaValue](#snapshotmetavalue)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/ssr/ssr-types.ts)

## SnapshotMetaValue

```typescript
export interface SnapshotMetaValue
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| c? |  | string | _(Optional)_ |
| h? |  | string | _(Optional)_ |
| s? |  | string | _(Optional)_ |
| w? |  | string | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/ssr/ssr-types.ts)

## SnapshotResult

```typescript
export interface SnapshotResult
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| funcs |  | string[] |  |
| mode |  | 'render' \\| 'listeners' \\| 'static' |  |
| objs? |  | any[] | _(Optional)_ |
| qrls |  | [QRL](#qrl-type-alias)[] |  |
| resources |  | ResourceReturnInternal<any>[] |  |
| state? |  | [SnapshotState](#snapshotstate) | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/ssr/ssr-types.ts)

## SnapshotState

> Warning: This API is now obsolete.
>
> not longer used in v2

```typescript
export interface SnapshotState
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| ctx |  | [SnapshotMeta](#snapshotmeta) |  |
| objs |  | any[] |  |
| refs |  | Record<string, string> |  |
| subs |  | any[] |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/ssr/ssr-types.ts)

## SSRComment

```typescript
SSRComment: FunctionComponent<{
  data: string;
}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## SSRHintProps

```typescript
export type SSRHintProps = {
  dynamic?: boolean;
};
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## SSRRaw

```typescript
SSRRaw: FunctionComponent<{
  data: string;
}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## SSRStream

```typescript
SSRStream: FunctionComponent<SSRStreamProps>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## SSRStreamBlock

```typescript
SSRStreamBlock: FunctionComponent<{
  children?: JSXOutput;
}>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## SSRStreamChildren

```typescript
export type SSRStreamChildren =
  | AsyncGenerator<JSXChildren, void, any>
  | ((stream: SSRStreamWriter) => Promise<void>)
  | (() => AsyncGenerator<JSXChildren, void, any>);
```

**References:** [JSXChildren](#jsxchildren), [SSRStreamWriter](#ssrstreamwriter)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## SSRStreamProps

```typescript
export type SSRStreamProps = {
  children: SSRStreamChildren;
};
```

**References:** [SSRStreamChildren](#ssrstreamchildren)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## SSRStreamWriter

```typescript
export interface SSRStreamWriter
```

| Method | Description |
| --- | --- |
| [write(chunk)](#ssrstreamwriter-write) |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/utils.public.ts)

## Suspense

```typescript
Suspense: typeof suspenseCmp;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/control-flow/suspense.tsx)

## SuspenseProps

```typescript
export type SuspenseProps = {
  fallback?: JSXOutput;
  delay?: number;
};
```

**References:** [JSXOutput](#jsxoutput)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/control-flow/suspense.tsx)

## SVGAttributes

The TS types don't include the SVG attributes so we have to define them ourselves

NOTE: These props are probably not complete

```typescript
export interface SVGAttributes<T extends Element = Element> extends AriaAttributes
```

**Extends:** AriaAttributes

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| "accent-height"? |  | number \\| string \\| undefined | _(Optional)_ |
| "alignment-baseline"? |  | 'auto' \\| 'baseline' \\| 'before-edge' \\| 'text-before-edge' \\| 'middle' \\| 'central' \\| 'after-edge' \\| 'text-after-edge' \\| 'ideographic' \\| 'alphabetic' \\| 'hanging' \\| 'mathematical' \\| 'inherit' \\| undefined | _(Optional)_ |
| "arabic-form"? |  | 'initial' \\| 'medial' \\| 'terminal' \\| 'isolated' \\| undefined | _(Optional)_ |
| "baseline-shift"? |  | number \\| string \\| undefined | _(Optional)_ |
| "cap-height"? |  | number \\| string \\| undefined | _(Optional)_ |
| "clip-path"? |  | string \\| undefined | _(Optional)_ |
| "clip-rule"? |  | number \\| string \\| undefined | _(Optional)_ |
| "color-interpolation-filters"? |  | 'auto' \\| 's-rGB' \\| 'linear-rGB' \\| 'inherit' \\| undefined | _(Optional)_ |
| "color-interpolation"? |  | number \\| string \\| undefined | _(Optional)_ |
| "color-profile"? |  | number \\| string \\| undefined | _(Optional)_ |
| "color-rendering"? |  | number \\| string \\| undefined | _(Optional)_ |
| "dominant-baseline"? |  | number \\| string \\| undefined | _(Optional)_ |
| "edge-mode"? |  | number \\| string \\| undefined | _(Optional)_ |
| "enable-background"? |  | number \\| string \\| undefined | _(Optional)_ |
| "fill-opacity"? |  | number \\| string \\| undefined | _(Optional)_ |
| "fill-rule"? |  | 'nonzero' \\| 'evenodd' \\| 'inherit' \\| undefined | _(Optional)_ |
| "flood-color"? |  | number \\| string \\| undefined | _(Optional)_ |
| "flood-opacity"? |  | number \\| string \\| undefined | _(Optional)_ |
| "font-family"? |  | string \\| undefined | _(Optional)_ |
| "font-size-adjust"? |  | number \\| string \\| undefined | _(Optional)_ |
| "font-size"? |  | number \\| string \\| undefined | _(Optional)_ |
| "font-stretch"? |  | number \\| string \\| undefined | _(Optional)_ |
| "font-style"? |  | number \\| string \\| undefined | _(Optional)_ |
| "font-variant"? |  | number \\| string \\| undefined | _(Optional)_ |
| "font-weight"? |  | number \\| string \\| undefined | _(Optional)_ |
| "glyph-name"? |  | number \\| string \\| undefined | _(Optional)_ |
| "glyph-orientation-horizontal"? |  | number \\| string \\| undefined | _(Optional)_ |
| "glyph-orientation-vertical"? |  | number \\| string \\| undefined | _(Optional)_ |
| "horiz-adv-x"? |  | number \\| string \\| undefined | _(Optional)_ |
| "horiz-origin-x"? |  | number \\| string \\| undefined | _(Optional)_ |
| "image-rendering"? |  | number \\| string \\| undefined | _(Optional)_ |
| "letter-spacing"? |  | number \\| string \\| undefined | _(Optional)_ |
| "lighting-color"? |  | number \\| string \\| undefined | _(Optional)_ |
| "marker-end"? |  | string \\| undefined | _(Optional)_ |
| "marker-mid"? |  | string \\| undefined | _(Optional)_ |
| "marker-start"? |  | string \\| undefined | _(Optional)_ |
| "overline-position"? |  | number \\| string \\| undefined | _(Optional)_ |
| "overline-thickness"? |  | number \\| string \\| undefined | _(Optional)_ |
| "paint-order"? |  | number \\| string \\| undefined | _(Optional)_ |
| "pointer-events"? |  | number \\| string \\| undefined | _(Optional)_ |
| "rendering-intent"? |  | number \\| string \\| undefined | _(Optional)_ |
| "shape-rendering"? |  | number \\| string \\| undefined | _(Optional)_ |
| "stop-color"? |  | string \\| undefined | _(Optional)_ |
| "stop-opacity"? |  | number \\| string \\| undefined | _(Optional)_ |
| "strikethrough-position"? |  | number \\| string \\| undefined | _(Optional)_ |
| "strikethrough-thickness"? |  | number \\| string \\| undefined | _(Optional)_ |
| "stroke-dasharray"? |  | string \\| number \\| undefined | _(Optional)_ |
| "stroke-dashoffset"? |  | string \\| number \\| undefined | _(Optional)_ |
| "stroke-linecap"? |  | 'butt' \\| 'round' \\| 'square' \\| 'inherit' \\| undefined | _(Optional)_ |
| "stroke-linejoin"? |  | 'miter' \\| 'round' \\| 'bevel' \\| 'inherit' \\| undefined | _(Optional)_ |
| "stroke-miterlimit"? |  | string \\| undefined | _(Optional)_ |
| "stroke-opacity"? |  | number \\| string \\| undefined | _(Optional)_ |
| "stroke-width"? |  | number \\| string \\| undefined | _(Optional)_ |
| "text-anchor"? |  | string \\| undefined | _(Optional)_ |
| "text-decoration"? |  | number \\| string \\| undefined | _(Optional)_ |
| "text-rendering"? |  | number \\| string \\| undefined | _(Optional)_ |
| "underline-position"? |  | number \\| string \\| undefined | _(Optional)_ |
| "underline-thickness"? |  | number \\| string \\| undefined | _(Optional)_ |
| "unicode-bidi"? |  | number \\| string \\| undefined | _(Optional)_ |
| "unicode-range"? |  | number \\| string \\| undefined | _(Optional)_ |
| "units-per-em"? |  | number \\| string \\| undefined | _(Optional)_ |
| "v-alphabetic"? |  | number \\| string \\| undefined | _(Optional)_ |
| "v-hanging"? |  | number \\| string \\| undefined | _(Optional)_ |
| "v-ideographic"? |  | number \\| string \\| undefined | _(Optional)_ |
| "v-mathematical"? |  | number \\| string \\| undefined | _(Optional)_ |
| "vector-effect"? |  | number \\| string \\| undefined | _(Optional)_ |
| "vert-adv-y"? |  | number \\| string \\| undefined | _(Optional)_ |
| "vert-origin-x"? |  | number \\| string \\| undefined | _(Optional)_ |
| "vert-origin-y"? |  | number \\| string \\| undefined | _(Optional)_ |
| "word-spacing"? |  | number \\| string \\| undefined | _(Optional)_ |
| "writing-mode"? |  | number \\| string \\| undefined | _(Optional)_ |
| "x-channel-selector"? |  | string \\| undefined | _(Optional)_ |
| "x-height"? |  | number \\| string \\| undefined | _(Optional)_ |
| ["xlink:actuate"?](#svgattributes-_xlink_actuate_) |  | string \\| undefined | _(Optional)_ |
| ["xlink:arcrole"?](#svgattributes-_xlink_arcrole_) |  | string \\| undefined | _(Optional)_ |
| ["xlink:href"?](#svgattributes-_xlink_href_) |  | string \\| undefined | _(Optional)_ |
| ["xlink:role"?](#svgattributes-_xlink_role_) |  | string \\| undefined | _(Optional)_ |
| ["xlink:show"?](#svgattributes-_xlink_show_) |  | string \\| undefined | _(Optional)_ |
| ["xlink:title"?](#svgattributes-_xlink_title_) |  | string \\| undefined | _(Optional)_ |
| ["xlink:type"?](#svgattributes-_xlink_type_) |  | string \\| undefined | _(Optional)_ |
| ["xml:base"?](#svgattributes-_xml_base_) |  | string \\| undefined | _(Optional)_ |
| ["xml:lang"?](#svgattributes-_xml_lang_) |  | string \\| undefined | _(Optional)_ |
| ["xml:space"?](#svgattributes-_xml_space_) |  | string \\| undefined | _(Optional)_ |
| ["xmlns:xlink"?](#svgattributes-_xmlns_xlink_) |  | string \\| undefined | _(Optional)_ |
| accumulate? |  | 'none' \\| 'sum' \\| undefined | _(Optional)_ |
| additive? |  | 'replace' \\| 'sum' \\| undefined | _(Optional)_ |
| allowReorder? |  | 'no' \\| 'yes' \\| undefined | _(Optional)_ |
| alphabetic? |  | number \\| string \\| undefined | _(Optional)_ |
| amplitude? |  | number \\| string \\| undefined | _(Optional)_ |
| ascent? |  | number \\| string \\| undefined | _(Optional)_ |
| attributeName? |  | string \\| undefined | _(Optional)_ |
| attributeType? |  | string \\| undefined | _(Optional)_ |
| autoReverse? |  | Booleanish \\| undefined | _(Optional)_ |
| azimuth? |  | number \\| string \\| undefined | _(Optional)_ |
| baseFrequency? |  | number \\| string \\| undefined | _(Optional)_ |
| baseProfile? |  | number \\| string \\| undefined | _(Optional)_ |
| bbox? |  | number \\| string \\| undefined | _(Optional)_ |
| begin? |  | number \\| string \\| undefined | _(Optional)_ |
| bias? |  | number \\| string \\| undefined | _(Optional)_ |
| by? |  | number \\| string \\| undefined | _(Optional)_ |
| calcMode? |  | number \\| string \\| undefined | _(Optional)_ |
| clip? |  | number \\| string \\| undefined | _(Optional)_ |
| clipPathUnits? |  | number \\| string \\| undefined | _(Optional)_ |
| color? |  | string \\| undefined | _(Optional)_ |
| contentScriptType? |  | number \\| string \\| undefined | _(Optional)_ |
| contentStyleType? |  | number \\| string \\| undefined | _(Optional)_ |
| crossOrigin? |  | HTMLCrossOriginAttribute | _(Optional)_ |
| cursor? |  | number \\| string | _(Optional)_ |
| cx? |  | number \\| string \\| undefined | _(Optional)_ |
| cy? |  | number \\| string \\| undefined | _(Optional)_ |
| d? |  | string \\| undefined | _(Optional)_ |
| decelerate? |  | number \\| string \\| undefined | _(Optional)_ |
| descent? |  | number \\| string \\| undefined | _(Optional)_ |
| diffuseConstant? |  | number \\| string \\| undefined | _(Optional)_ |
| direction? |  | number \\| string \\| undefined | _(Optional)_ |
| display? |  | number \\| string \\| undefined | _(Optional)_ |
| divisor? |  | number \\| string \\| undefined | _(Optional)_ |
| dur? |  | number \\| string \\| undefined | _(Optional)_ |
| dx? |  | number \\| string \\| undefined | _(Optional)_ |
| dy? |  | number \\| string \\| undefined | _(Optional)_ |
| elevation? |  | number \\| string \\| undefined | _(Optional)_ |
| end? |  | number \\| string \\| undefined | _(Optional)_ |
| exponent? |  | number \\| string \\| undefined | _(Optional)_ |
| externalResourcesRequired? |  | number \\| string \\| undefined | _(Optional)_ |
| fill? |  | string \\| undefined | _(Optional)_ |
| filter? |  | string \\| undefined | _(Optional)_ |
| filterRes? |  | number \\| string \\| undefined | _(Optional)_ |
| filterUnits? |  | number \\| string \\| undefined | _(Optional)_ |
| focusable? |  | number \\| string \\| undefined | _(Optional)_ |
| format? |  | number \\| string \\| undefined | _(Optional)_ |
| fr? |  | number \\| string \\| undefined | _(Optional)_ |
| from? |  | number \\| string \\| undefined | _(Optional)_ |
| fx? |  | number \\| string \\| undefined | _(Optional)_ |
| fy? |  | number \\| string \\| undefined | _(Optional)_ |
| g1? |  | number \\| string \\| undefined | _(Optional)_ |
| g2? |  | number \\| string \\| undefined | _(Optional)_ |
| glyphRef? |  | number \\| string \\| undefined | _(Optional)_ |
| gradientTransform? |  | string \\| undefined | _(Optional)_ |
| gradientUnits? |  | string \\| undefined | _(Optional)_ |
| hanging? |  | number \\| string \\| undefined | _(Optional)_ |
| height? |  | Size \\| undefined | _(Optional)_ |
| href? |  | string \\| undefined | _(Optional)_ |
| id? |  | string \\| undefined | _(Optional)_ |
| ideographic? |  | number \\| string \\| undefined | _(Optional)_ |
| in? |  | string \\| undefined | _(Optional)_ |
| in2? |  | number \\| string \\| undefined | _(Optional)_ |
| intercept? |  | number \\| string \\| undefined | _(Optional)_ |
| k? |  | number \\| string \\| undefined | _(Optional)_ |
| k1? |  | number \\| string \\| undefined | _(Optional)_ |
| k2? |  | number \\| string \\| undefined | _(Optional)_ |
| k3? |  | number \\| string \\| undefined | _(Optional)_ |
| k4? |  | number \\| string \\| undefined | _(Optional)_ |
| kernelMatrix? |  | number \\| string \\| undefined | _(Optional)_ |
| kernelUnitLength? |  | number \\| string \\| undefined | _(Optional)_ |
| kerning? |  | number \\| string \\| undefined | _(Optional)_ |
| keyPoints? |  | number \\| string \\| undefined | _(Optional)_ |
| keySplines? |  | number \\| string \\| undefined | _(Optional)_ |
| keyTimes? |  | number \\| string \\| undefined | _(Optional)_ |
| lang? |  | string \\| undefined | _(Optional)_ |
| lengthAdjust? |  | number \\| string \\| undefined | _(Optional)_ |
| limitingConeAngle? |  | number \\| string \\| undefined | _(Optional)_ |
| local? |  | number \\| string \\| undefined | _(Optional)_ |
| markerHeight? |  | number \\| string \\| undefined | _(Optional)_ |
| markerUnits? |  | number \\| string \\| undefined | _(Optional)_ |
| markerWidth? |  | number \\| string \\| undefined | _(Optional)_ |
| mask? |  | string \\| undefined | _(Optional)_ |
| maskContentUnits? |  | number \\| string \\| undefined | _(Optional)_ |
| maskUnits? |  | number \\| string \\| undefined | _(Optional)_ |
| mathematical? |  | number \\| string \\| undefined | _(Optional)_ |
| max? |  | number \\| string \\| undefined | _(Optional)_ |
| media? |  | string \\| undefined | _(Optional)_ |
| method? |  | string \\| undefined | _(Optional)_ |
| min? |  | number \\| string \\| undefined | _(Optional)_ |
| mode? |  | number \\| string \\| undefined | _(Optional)_ |
| name? |  | string \\| undefined | _(Optional)_ |
| numOctaves? |  | number \\| string \\| undefined | _(Optional)_ |
| offset? |  | number \\| string \\| undefined | _(Optional)_ |
| opacity? |  | number \\| string \\| undefined | _(Optional)_ |
| operator? |  | number \\| string \\| undefined | _(Optional)_ |
| order? |  | number \\| string \\| undefined | _(Optional)_ |
| orient? |  | number \\| string \\| undefined | _(Optional)_ |
| orientation? |  | number \\| string \\| undefined | _(Optional)_ |
| origin? |  | number \\| string \\| undefined | _(Optional)_ |
| overflow? |  | number \\| string \\| undefined | _(Optional)_ |
| panose1? |  | number \\| string \\| undefined | _(Optional)_ |
| path? |  | string \\| undefined | _(Optional)_ |
| pathLength? |  | number \\| string \\| undefined | _(Optional)_ |
| patternContentUnits? |  | string \\| undefined | _(Optional)_ |
| patternTransform? |  | number \\| string \\| undefined | _(Optional)_ |
| patternUnits? |  | string \\| undefined | _(Optional)_ |
| points? |  | string \\| undefined | _(Optional)_ |
| pointsAtX? |  | number \\| string \\| undefined | _(Optional)_ |
| pointsAtY? |  | number \\| string \\| undefined | _(Optional)_ |
| pointsAtZ? |  | number \\| string \\| undefined | _(Optional)_ |
| preserveAlpha? |  | number \\| string \\| undefined | _(Optional)_ |
| preserveAspectRatio? |  | string \\| undefined | _(Optional)_ |
| primitiveUnits? |  | number \\| string \\| undefined | _(Optional)_ |
| r? |  | number \\| string \\| undefined | _(Optional)_ |
| radius? |  | number \\| string \\| undefined | _(Optional)_ |
| refX? |  | number \\| string \\| undefined | _(Optional)_ |
| refY? |  | number \\| string \\| undefined | _(Optional)_ |
| repeatCount? |  | number \\| string \\| undefined | _(Optional)_ |
| repeatDur? |  | number \\| string \\| undefined | _(Optional)_ |
| requiredextensions? |  | number \\| string \\| undefined | _(Optional)_ |
| requiredFeatures? |  | number \\| string \\| undefined | _(Optional)_ |
| restart? |  | number \\| string \\| undefined | _(Optional)_ |
| result? |  | string \\| undefined | _(Optional)_ |
| role? |  | string \\| undefined | _(Optional)_ |
| rotate? |  | number \\| string \\| undefined | _(Optional)_ |
| rx? |  | number \\| string \\| undefined | _(Optional)_ |
| ry? |  | number \\| string \\| undefined | _(Optional)_ |
| scale? |  | number \\| string \\| undefined | _(Optional)_ |
| seed? |  | number \\| string \\| undefined | _(Optional)_ |
| slope? |  | number \\| string \\| undefined | _(Optional)_ |
| spacing? |  | number \\| string \\| undefined | _(Optional)_ |
| specularConstant? |  | number \\| string \\| undefined | _(Optional)_ |
| specularExponent? |  | number \\| string \\| undefined | _(Optional)_ |
| speed? |  | number \\| string \\| undefined | _(Optional)_ |
| spreadMethod? |  | string \\| undefined | _(Optional)_ |
| startOffset? |  | number \\| string \\| undefined | _(Optional)_ |
| stdDeviation? |  | number \\| string \\| undefined | _(Optional)_ |
| stemh? |  | number \\| string \\| undefined | _(Optional)_ |
| stemv? |  | number \\| string \\| undefined | _(Optional)_ |
| stitchTiles? |  | number \\| string \\| undefined | _(Optional)_ |
| string? |  | number \\| string \\| undefined | _(Optional)_ |
| stroke? |  | string \\| undefined | _(Optional)_ |
| style? |  | [CSSProperties](#cssproperties) \\| string \\| undefined | _(Optional)_ |
| surfaceScale? |  | number \\| string \\| undefined | _(Optional)_ |
| systemLanguage? |  | number \\| string \\| undefined | _(Optional)_ |
| tabindex? |  | number \\| undefined | _(Optional)_ |
| tableValues? |  | number \\| string \\| undefined | _(Optional)_ |
| target? |  | string \\| undefined | _(Optional)_ |
| targetX? |  | number \\| string \\| undefined | _(Optional)_ |
| targetY? |  | number \\| string \\| undefined | _(Optional)_ |
| textLength? |  | number \\| string \\| undefined | _(Optional)_ |
| to? |  | number \\| string \\| undefined | _(Optional)_ |
| transform? |  | string \\| undefined | _(Optional)_ |
| type? |  | string \\| undefined | _(Optional)_ |
| u1? |  | number \\| string \\| undefined | _(Optional)_ |
| u2? |  | number \\| string \\| undefined | _(Optional)_ |
| unicode? |  | number \\| string \\| undefined | _(Optional)_ |
| values? |  | string \\| undefined | _(Optional)_ |
| version? |  | string \\| undefined | _(Optional)_ |
| viewBox? |  | string \\| undefined | _(Optional)_ |
| viewTarget? |  | number \\| string \\| undefined | _(Optional)_ |
| visibility? |  | number \\| string \\| undefined | _(Optional)_ |
| width? |  | Size \\| undefined | _(Optional)_ |
| widths? |  | number \\| string \\| undefined | _(Optional)_ |
| x? |  | number \\| string \\| undefined | _(Optional)_ |
| x1? |  | number \\| string \\| undefined | _(Optional)_ |
| x2? |  | number \\| string \\| undefined | _(Optional)_ |
| xmlns? |  | string \\| undefined | _(Optional)_ |
| y? |  | number \\| string \\| undefined | _(Optional)_ |
| y1? |  | number \\| string \\| undefined | _(Optional)_ |
| y2? |  | number \\| string \\| undefined | _(Optional)_ |
| yChannelSelector? |  | string \\| undefined | _(Optional)_ |
| z? |  | number \\| string \\| undefined | _(Optional)_ |
| zoomAndPan? |  | string \\| undefined | _(Optional)_ |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## SVGProps

```typescript
export interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T>
```

**Extends:** [SVGAttributes](#svgattributes), [QwikAttributes](#qwikattributes)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## sync$

Extract function into a synchronously loadable QRL.

NOTE: Synchronous QRLs functions can't close over any variables, including exports.

```typescript
sync$: <T extends Function>(fn: T) => SyncQRL<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| fn | T | Function to extract. |

**Returns:**

[SyncQRL](#syncqrl)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/qrl.public.ts)

## SyncQRL

```typescript
export type SyncQRL<TYPE extends Function> = QRL<TYPE> & {
  __brand__SyncQRL__: TYPE;
  resolved: TYPE;
  dev?: QRLDev | null;
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
```

**References:** [QRL](#qrl-type-alias)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/qrl/qrl.public.ts)

## TaskCtx

```typescript
export interface TaskCtx
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| cleanup |  | (callback: () => [ValueOrPromise](#valueorpromise)<void>) => void |  |
| track |  | [Tracker](#tracker) |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-task.ts)

## TaskFn

```typescript
export type TaskFn = (
  ctx: TaskCtx,
) => ValueOrPromise<void | (() => ValueOrPromise<void>)>;
```

**References:** [TaskCtx](#taskctx), [ValueOrPromise](#valueorpromise)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-task.ts)

## TaskOptions

```typescript
export interface TaskOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| deferUpdates? |  | boolean | _(Optional)_ Block the rendering of the component until the task completes. Default is `true` |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-task.ts)

## Tracker

Used to signal to Qwik which state should be watched for changes.

The `Tracker` is passed into the `taskFn` of `useTask`. It is intended to be used to wrap state objects in a read proxy which signals to Qwik which properties should be watched for changes. A change to any of the properties causes the `taskFn` to rerun.

### Example

The `obs` passed into the `taskFn` is used to mark `state.count` as a property of interest. Any changes to the `state.count` property will cause the `taskFn` to rerun.

```tsx
const Cmp = component$(() => {
  const store = useStore({ count: 0, doubleCount: 0 });
  const signal = useSignal(0);
  useTask$(({ track }) => {
    // Any signals or stores accessed inside the task will be tracked
    const count = track(() => store.count);
    // For stores you can also pass the store and specify the property
    track(store, "count");
    // You can also pass a signal to track() directly
    const signalCount = track(signal);
    store.doubleCount = count + signalCount;
  });
  return (
    <div>
      <span>
        {store.count} / {store.doubleCount}
      </span>
      <button
        onClick$={() => {
          store.count++;
          signal.value++;
        }}
      >
        +
      </button>
    </div>
  );
});
```

```typescript
export interface Tracker
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-task.ts)

## trigger

Use this to trigger running subscribers, for example when the value mutated but remained the same object.

```typescript
trigger(): void;
```

**Returns:**

void

## untrack

Get the value of the expression without tracking listeners. A function will be invoked, signals will return their value, and stores will be unwrapped (they return the backing object).

When you pass a function, you can also pass additional arguments that the function will receive.

Note that stores are not unwrapped recursively.

```typescript
untrack: <T, A extends any[]>(
  expr: ((...args: A) => T) | Signal<T> | T,
  ...args: A
) => T;
```

| Parameter | Type | Description |
| --- | --- | --- |
| expr | ((...args: A) => T) \\| [Signal](#signal)<T> \\| T | The function or object to evaluate without tracking. |
| args | A | Additional arguments to pass when `expr` is a function. |

**Returns:**

T

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-core.ts)

## unwrapStore

Get the original object that was wrapped by the store. Useful if you want to clone a store (structuredClone, IndexedDB,...)

```typescript
unwrapStore: <T>(value: T) => T;
```

| Parameter | Type | Description |
| --- | --- | --- |
| value | T |  |

**Returns:**

T

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/reactive-primitives/impl/store.ts)

## useComputed$

Creates a computed signal which is calculated from the given function. A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated, and if the result changed, all tasks which are tracking the signal will be re-run and all components that read the signal will be re-rendered.

Every synchronous signal or store read is tracked automatically. Reads after an `await` are not: the tracking context is lost, so track them explicitly with the `track()` provided on the context argument. When the function is async, the returned signal exposes the async API: reading an unresolved `.value` throws the computation promise, and `.pending` and `.error` expose the computation state.

The function must not have any side effects.

```typescript
useComputed$: <T>(
  qrl: ComputedFn<T>,
  options?: ComputedOptions<T> | undefined,
) => ComputedReturnType<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| qrl | [ComputedFn](#computedfn)<T> |  |
| options | [ComputedOptions](#computedoptions)<T> \\| undefined | _(Optional)_ |

**Returns:**

[ComputedReturnType](#computedreturntype)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts)

## useConstant

Stores a value which is retained for the lifetime of the component. Subsequent calls to `useConstant` will always return the first value given.

If the value is a function, the function is invoked once to calculate the actual value. You can then also pass arguments to call the function with, so that you don't need to create a new function on every render.

```typescript
useConstant: <T, A extends any[]>(value: ((...args: A) => T) | T, ...args: A) =>
  T;
```

| Parameter | Type | Description |
| --- | --- | --- |
| value | ((...args: A) => T) \\| T |  |
| args | A |  |

**Returns:**

T

```tsx
const fixedRandomValue = useConstant(() => Math.random);
const otherFixedRandomValue = useConstant(Math.random);

const getConfig = (env: string) => { ... }
const config = useConstant(getConfig, environment);
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-signal.ts)

## useContext

Retrieve Context value.

Use `useContext()` to retrieve the value of context in a component. To retrieve a value a parent component needs to invoke `useContextProvider()` to assign a value.

### Example

```tsx
// Declare the Context type.
interface TodosStore {
  items: string[];
}
// Create a Context ID (no data is saved here.)
// You will use this ID to both create and retrieve the Context.
export const TodosContext = createContextId<TodosStore>("Todos");

// Example of providing context to child components.
export const App = component$(() => {
  useContextProvider(
    TodosContext,
    useStore<TodosStore>({
      items: ["Learn Qwik", "Build Qwik app", "Profit"],
    }),
  );

  return <Items />;
});

// Example of retrieving the context provided by a parent component.
export const Items = component$(() => {
  const todos = useContext(TodosContext);
  return (
    <ul>
      {todos.items.map((item) => (
        <li>{item}</li>
      ))}
    </ul>
  );
});
```

```typescript
useContext: UseContext;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-context.ts)

## useContextProvider

Assign a value to a Context.

Use `useContextProvider()` to assign a value to a context. The assignment happens in the component's function. Once assigned, use `useContext()` in any child component to retrieve the value.

Context is a way to pass stores to the child components without prop-drilling. Note that scalar values are allowed, but for reactivity you need signals or stores.

### Example

```tsx
// Declare the Context type.
interface TodosStore {
  items: string[];
}
// Create a Context ID (no data is saved here.)
// You will use this ID to both create and retrieve the Context.
export const TodosContext = createContextId<TodosStore>("Todos");

// Example of providing context to child components.
export const App = component$(() => {
  useContextProvider(
    TodosContext,
    useStore<TodosStore>({
      items: ["Learn Qwik", "Build Qwik app", "Profit"],
    }),
  );

  return <Items />;
});

// Example of retrieving the context provided by a parent component.
export const Items = component$(() => {
  const todos = useContext(TodosContext);
  return (
    <ul>
      {todos.items.map((item) => (
        <li>{item}</li>
      ))}
    </ul>
  );
});
```

```typescript
useContextProvider: <STATE>(context: ContextId<STATE>, newValue: STATE) => void
```

| Parameter | Type | Description |
| --- | --- | --- |
| context | [ContextId](#contextid)<STATE> | The context to assign a value to. |
| newValue | STATE |  |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-context.ts)

## useId

```typescript
useId: () => string;
```

**Returns:**

string

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-id.ts)

## useOn

Register a listener on the current component's host element.

Used to programmatically add event listeners. Useful from custom `use*` methods, which do not have access to the JSX. Otherwise, it's adding a JSX listener in the `<div>` is a better idea.

Events are case sensitive.

```typescript
useOn: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void
```

| Parameter | Type | Description |
| --- | --- | --- |
| event | T \\| T[] |  |
| eventQrl | EventQRL<T> |  |
| options | [UseOnOptions](#useonoptions) | _(Optional)_ |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-on.ts)

## useOnDocument

Register a listener on `document`.

Used to programmatically add event listeners. Useful from custom `use*` methods, which do not have access to the JSX.

Events are case sensitive.

```typescript
useOnDocument: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void
```

| Parameter | Type | Description |
| --- | --- | --- |
| event | T \\| T[] |  |
| eventQrl | EventQRL<T> |  |
| options | [UseOnOptions](#useonoptions) | _(Optional)_ |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-on.ts)

## UseOnOptions

```typescript
export type UseOnOptions = UseOnOptionsBase &
  (
    | {
        passive?: boolean;
        preventdefault?: never;
      }
    | {
        passive?: never;
        preventdefault?: boolean;
      }
  );
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-on.ts)

## useOnWindow

Register a listener on `window`.

Used to programmatically add event listeners. Useful from custom `use*` methods, which do not have access to the JSX.

Events are case sensitive.

```typescript
useOnWindow: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void
```

| Parameter | Type | Description |
| --- | --- | --- |
| event | T \\| T[] |  |
| eventQrl | EventQRL<T> |  |
| options | [UseOnOptions](#useonoptions) | _(Optional)_ |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-on.ts)

## useResource$

> Warning: This API is now obsolete.
>
> Use `useComputed$` instead, which is more powerful and flexible. `useResource$` is still available for backward compatibility but it is recommended to migrate to `useComputed$` for new code and when updating existing code.

This method works like an async memoized function that runs whenever some tracked value changes and returns some data.

`useResource` however returns immediate a `ResourceReturn` object that contains the data and a state that indicates if the data is available or not.

The status can be one of the following:

- `pending` - the data is not yet available. - `resolved` - the data is available. - `rejected` - the data is not available due to an error or timeout.

Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't re-throw it (or a new Error), the resource status will never be `rejected`.

```typescript
useResource$: <T>(
  qrl: import("./use-resource").ResourceFn<T>,
  opts?: import("./use-resource").ResourceOptions | undefined,
) => import("./use-resource").ResourceReturn<T>;
```

| Parameter | Type | Description |
| --- | --- | --- |
| qrl | import("./use-resource").[ResourceFn](#resourcefn)<T> |  |
| opts | import("./use-resource").[ResourceOptions](#resourceoptions) \\| undefined | _(Optional)_ |

**Returns:**

import("./use-resource").[ResourceReturn](#resourcereturn)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-resource-dollar.ts)

## useSerializer$

Creates a signal which holds a custom serializable value. It requires that the value implements the `CustomSerializable` type, which means having a function under the `[SerializeSymbol]` property that returns a serializable value when called.

The `fn` you pass is called with the result of the serialization (in the browser, only when the value is needed), or `undefined` when not yet initialized. If you refer to other signals, `fn` will be called when those change just like computed signals, and then the argument will be the previous output, not the serialized result.

This is useful when using third party libraries that use custom objects that are not serializable.

Note that the `fn` is called lazily, so it won't impact container resume.

```typescript
useSerializer$: typeof createSerializer$;
```

```tsx
class MyCustomSerializable {
  constructor(public n: number) {}
  inc() {
    this.n++;
  }
}
const Cmp = component$(() => {
  const custom = useSerializer$({
    deserialize: (data) => new MyCustomSerializable(data),
    serialize: (data) => data.n,
    initial: 2,
  });
  return <div onClick$={() => custom.value.inc()}>{custom.value.n}</div>;
});
```

When using a Signal as the data to create the object, you need to pass the configuration as a function, and you can then also provide the `update` function to update the object when the signal changes.

By returning an object from `update`, you signal that the listeners have to be notified. You can mutate the current object but you should return it so that it will trigger listeners.

```tsx
const Cmp = component$(() => {
  const n = useSignal(2);
  const custom = useSerializer$(() => ({
    deserialize: () => new MyCustomSerializable(n.value),
    update: (current) => {
      current.n = n.value;
      return current;
    },
  }));
  return <div onClick$={() => n.value++}>{custom.value.n}</div>;
});
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-serializer.ts)

## useServerData

```typescript
export declare function useServerData<T>(key: string): T | undefined;
```

| Parameter | Type | Description |
| --- | --- | --- |
| key | string |  |

**Returns:**

T \| undefined

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-env-data.ts)

## useSignal

Creates an object with a single reactive `.value` property, that Qwik can track across serializations.

Use it to create state for your application. The object has a getter and setter to track reads and writes of the `.value` property. When the value changes, any functions that read from it will re-run.

Prefer `useSignal` over `useStore` when possible, as it is more efficient.

### Example

```tsx
const Signals = component$(() => {
  const counter = useSignal(1);
  const text = useSignal('changeme');
  const toggle = useSignal(false);

  // useSignal() can also accept a function to calculate the initial value
  const state = useSignal(() => {
    return expensiveInitialValue();
  });

  return (
    <div>
      <button onClick$={() => counter.value++}>Counter: {counter.value}</button>
      {
        // pass signal values as the value, the optimizer will make it pass the signal
      }
      <Child state={state.value} />
      {
        // signals can be bound to inputs. A property named `bind:x` implies that the property
is a signal
      }
      <input type="text" bind:value={text} />
      <input type="checkbox" bind:checked={toggle} />
    </div>
  );
});
```

```typescript
useSignal: UseSignal;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-signal.ts)

## UseSignal

Creates an object with a single reactive `.value` property, that Qwik can track across serializations.

Use it to create state for your application. The object has a getter and setter to track reads and writes of the `.value` property. When the value changes, any functions that read from it will re-run.

Prefer `useSignal` over `useStore` when possible, as it is more efficient.

### Example

```tsx
const Signals = component$(() => {
  const counter = useSignal(1);
  const text = useSignal('changeme');
  const toggle = useSignal(false);

  // useSignal() can also accept a function to calculate the initial value
  const state = useSignal(() => {
    return expensiveInitialValue();
  });

  return (
    <div>
      <button onClick$={() => counter.value++}>Counter: {counter.value}</button>
      {
        // pass signal values as the value, the optimizer will make it pass the signal
      }
      <Child state={state.value} />
      {
        // signals can be bound to inputs. A property named `bind:x` implies that the property
is a signal
      }
      <input type="text" bind:value={text} />
      <input type="checkbox" bind:checked={toggle} />
    </div>
  );
});
```

```typescript
useSignal: UseSignal;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-signal.ts)

## useStore

Creates a reactive object that Qwik can track across serialization.

Use it to create state for your application. The returned object is a Proxy that tracks reads and writes. When any of the properties change, the functions that read those properties will re-run.

`Store`s are deep by default, meaning that any objects assigned to properties will also become `Store`s. This includes arrays.

Prefer `useSignal` over `useStore` when possible, as it is more efficient.

### Example

Example showing how `useStore` is used in Counter example to keep track of the count.

```tsx
const Stores = component$(() => {
  const counter = useCounter(1);

  // Reactivity happens even for nested objects and arrays
  const userData = useStore({
    name: "Manu",
    address: {
      address: "",
      city: "",
    },
    orgs: [],
  });

  // useStore() can also accept a function to calculate the initial value
  const state = useStore(() => {
    return {
      value: expensiveInitialValue(),
    };
  });

  return (
    <div>
      <div>Counter: {counter.value}</div>
      <Child userData={userData} state={state} />
    </div>
  );
});

function useCounter(step: number) {
  // Multiple stores can be created in custom hooks for convenience and composability
  const counterStore = useStore({
    value: 0,
  });
  useVisibleTask$(() => {
    // Only runs in the client
    const timer = setInterval(() => {
      counterStore.value += step;
    }, 500);
    return () => {
      clearInterval(timer);
    };
  });
  return counterStore;
}
```

```typescript
useStore: <STATE extends object>(
  initialState: STATE | (() => STATE),
  opts?: UseStoreOptions,
) => STATE;
```

| Parameter | Type | Description |
| --- | --- | --- |
| initialState | STATE \\| (() => STATE) |  |
| opts | [UseStoreOptions](#usestoreoptions) | _(Optional)_ |

**Returns:**

STATE

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-store.public.ts)

## UseStoreOptions

```typescript
export interface UseStoreOptions
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| deep? |  | boolean | _(Optional)_ If `true` then all nested objects and arrays will be tracked as well. Default is `true`. |
| reactive? |  | boolean | _(Optional)_ If `false` then the object will not be tracked for changes. Default is `true`. |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-store.public.ts)

## useStyles$

A lazy-loadable reference to a component's styles.

Component styles allow Qwik to lazy load the style information for the component only when needed. (And avoid double loading it in case of SSR hydration.)

```tsx
import styles from "./code-block.css?inline";

export const CmpStyles = component$(() => {
  useStyles$(styles);

  return <div>Some text</div>;
});
```

```typescript
useStyles$: (qrl: string) => UseStyles;
```

| Parameter | Type | Description |
| --- | --- | --- |
| qrl | string |  |

**Returns:**

UseStyles

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-styles.ts)

## UseStylesScoped

```typescript
export interface UseStylesScoped
```

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| scopeId |  | string |  |

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-styles.ts)

## useStylesScoped$

A lazy-loadable reference to a component's styles, that is scoped to the component.

Component styles allow Qwik to lazy load the style information for the component only when needed. (And avoid double loading it in case of SSR hydration.)

```tsx
import scoped from "./code-block.css?inline";

export const CmpScopedStyles = component$(() => {
  useStylesScoped$(scoped);

  return <div>Some text</div>;
});
```

```typescript
useStylesScoped$: (qrl: string) => UseStylesScoped;
```

| Parameter | Type | Description |
| --- | --- | --- |
| qrl | string |  |

**Returns:**

[UseStylesScoped](#usestylesscoped)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-styles.ts)

## useTask$

Reruns the `taskFn` when the observed inputs change.

Use `useTask` to observe changes on a set of inputs, and then re-execute the `taskFn` when those inputs change.

The `taskFn` only executes if the observed inputs change. To observe the inputs, use the `obs` function to wrap property reads. This creates subscriptions that will trigger the `taskFn` to rerun.

```typescript
useTask$: (fn: TaskFn, opts?: TaskOptions) => void
```

| Parameter | Type | Description |
| --- | --- | --- |
| fn | [TaskFn](#taskfn) |  |
| opts | [TaskOptions](#taskoptions) | _(Optional)_ |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-task-dollar.ts)

## useVisibleTask$

```tsx
const Timer = component$(() => {
  const store = useStore({
    count: 0,
  });

  useVisibleTask$(() => {
    // Only runs in the client
    const timer = setInterval(() => {
      store.count++;
    }, 500);
    return () => {
      clearInterval(timer);
    };
  });

  return <div>{store.count}</div>;
});
```

```typescript
useVisibleTask$: (fn: TaskFn, opts?: OnVisibleTaskOptions) => void
```

| Parameter | Type | Description |
| --- | --- | --- |
| fn | [TaskFn](#taskfn) |  |
| opts | [OnVisibleTaskOptions](#onvisibletaskoptions) | _(Optional)_ |

**Returns:**

void

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-visible-task-dollar.ts)

## ValueOrPromise

Type representing a value which is either resolve or a promise.

```typescript
export type ValueOrPromise<T> = T | Promise<T>;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/utils/types.ts)

## version

QWIK_VERSION

```typescript
version: string;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/version.ts)

## VisibleTaskStrategy

```typescript
export type VisibleTaskStrategy =
  | "intersection-observer"
  | "document-ready"
  | "document-idle";
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-visible-task.ts)

## withLocale

Override the `getLocale` with `lang` within the `fn` execution.

```typescript
export declare function withLocale<T>(locale: string, fn: () => T): T;
```

| Parameter | Type | Description |
| --- | --- | --- |
| locale | string |  |
| fn | () => T |  |

**Returns:**

T

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-locale.ts)

## write

```typescript
write(chunk: JSXOutput): void;
```

| Parameter | Type | Description |
| --- | --- | --- |
| chunk | [JSXOutput](#jsxoutput) |  |

**Returns:**

void
