@rx-angular/state
Version:
@rx-angular/state is a light-weight, flexible, strongly typed and tested tool dedicated to reduce the complexity of managing component state and side effects in angular
29 lines • 1.01 kB
TypeScript
import { RxState as LegacyState } from './rx-state.service';
export type RxState<T extends object> = Pick<LegacyState<T>, 'get' | 'select' | 'connect' | 'set' | '$' | 'setAccumulator' | 'signal' | 'computed' | 'computedFrom' | 'asReadOnly'>;
export type RxStateSetupFn<State extends object> = (rxState: Pick<RxState<State>, 'connect' | 'set' | 'get' | 'select' | 'setAccumulator'>) => void;
/**
* @description
* Functional way to setup state management with RxState. It's a wrapper around RxState that automatically get
* destroyed.
*
* @example
* ```ts
* import { rxState } from '@rx-angular/state';
*
* Component({})
* export class FooComponent {
* readonly state = rxState<{ count: number }>(({ set }) => set({ count: 0 }));
* }
* ```
*
* @param setupFn
* @returns RxState instance
*
*
*
* @docsCategory RxState
* @docsPage RxState
*
*/
export declare function rxState<State extends object>(setupFn?: RxStateSetupFn<State>): RxState<State>;
//# sourceMappingURL=rx-state.d.ts.map