impair
Version:
impair is a React framework bringing several programming concepts together in order to provide a foundation for a layered, scalable, performant and enterprise level react application.
19 lines (18 loc) • 761 B
TypeScript
/**
* Disables dependency tracking within the provided function's execution context.
* Reactive properties accessed inside the function will not be tracked as dependencies,
* meaning changes to them will not trigger reactive updates for the current effect scope.
* This can be useful in triggers, derived computations, or component renders where
* you want to access reactive data without establishing a dependency.
* ```ts
* \@state firstName = 'John'
* \@state lastName = 'Doe'
*
* \@trigger
* public logFullName() {
* const fullName = this.firstName + untrack(() => this.lastName);
* console.log(fullName); // Will log only when firstName changes
* });
* ```
*/
export declare function untrack<T extends () => any>(fn: T): ReturnType<T>;