|
| 1 | +--- |
| 2 | +id: TanStackStoreSelector |
| 3 | +title: TanStackStoreSelector |
| 4 | +--- |
| 5 | + |
| 6 | +# Class: TanStackStoreSelector\<TSource, TSelected\> |
| 7 | + |
| 8 | +Defined in: [tan-stack-store-selector.ts:22](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L22) |
| 9 | + |
| 10 | +## Type Parameters |
| 11 | + |
| 12 | +### TSource |
| 13 | + |
| 14 | +`TSource` |
| 15 | + |
| 16 | +### TSelected |
| 17 | + |
| 18 | +`TSelected` = `NoInfer`\<`TSource`\> |
| 19 | + |
| 20 | +## Implements |
| 21 | + |
| 22 | +- `ReactiveController` |
| 23 | + |
| 24 | +## Constructors |
| 25 | + |
| 26 | +### Constructor |
| 27 | + |
| 28 | +```ts |
| 29 | +new TanStackStoreSelector<TSource, TSelected>( |
| 30 | + host, |
| 31 | + getStore, |
| 32 | + selector, |
| 33 | +options?): TanStackStoreSelector<TSource, TSelected>; |
| 34 | +``` |
| 35 | +
|
| 36 | +Defined in: [tan-stack-store-selector.ts:35](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L35) |
| 37 | +
|
| 38 | +#### Parameters |
| 39 | +
|
| 40 | +##### host |
| 41 | +
|
| 42 | +`ReactiveControllerHost` |
| 43 | +
|
| 44 | +##### getStore |
| 45 | +
|
| 46 | +() => `SelectionSource`\<`TSource`\> \| `undefined` |
| 47 | +
|
| 48 | +##### selector |
| 49 | +
|
| 50 | +(`snapshot`) => `TSelected` |
| 51 | +
|
| 52 | +##### options? |
| 53 | +
|
| 54 | +[`UseSelectorOptions`](../interfaces/UseSelectorOptions.md)\<`TSelected`\> |
| 55 | +
|
| 56 | +#### Returns |
| 57 | +
|
| 58 | +`TanStackStoreSelector`\<`TSource`, `TSelected`\> |
| 59 | +
|
| 60 | +## Methods |
| 61 | +
|
| 62 | +### hostDisconnected() |
| 63 | +
|
| 64 | +```ts |
| 65 | +hostDisconnected(): void; |
| 66 | +``` |
| 67 | +
|
| 68 | +Defined in: [tan-stack-store-selector.ts:72](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L72) |
| 69 | +
|
| 70 | +Called when the host is disconnected from the component tree. For custom |
| 71 | +element hosts, this corresponds to the `disconnectedCallback()` lifecycle, |
| 72 | +which is called the host or an ancestor component is disconnected from the |
| 73 | +document. |
| 74 | +
|
| 75 | +#### Returns |
| 76 | +
|
| 77 | +`void` |
| 78 | +
|
| 79 | +#### Implementation of |
| 80 | +
|
| 81 | +```ts |
| 82 | +ReactiveController.hostDisconnected |
| 83 | +``` |
| 84 | +
|
| 85 | +*** |
| 86 | +
|
| 87 | +### hostUpdate() |
| 88 | +
|
| 89 | +```ts |
| 90 | +hostUpdate(): void; |
| 91 | +``` |
| 92 | +
|
| 93 | +Defined in: [tan-stack-store-selector.ts:48](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L48) |
| 94 | +
|
| 95 | +Called during the client-side host update, just before the host calls |
| 96 | +its own update. |
| 97 | +
|
| 98 | +Code in `update()` can depend on the DOM as it is not called in |
| 99 | +server-side rendering. |
| 100 | +
|
| 101 | +#### Returns |
| 102 | +
|
| 103 | +`void` |
| 104 | +
|
| 105 | +#### Implementation of |
| 106 | +
|
| 107 | +```ts |
| 108 | +ReactiveController.hostUpdate |
| 109 | +``` |
0 commit comments