Runs a function without tracking dependencies. This means that any signal accesses within the function won't create dependencies for the current tracking context.
Type:
Parameters:
fn: The function to run without trackingReturns: The return value of fn
Example:
Batches multiple state updates into a single re-render. This optimizes performance by ensuring that multiple changes to reactive values don't trigger multiple re-renders.
Type:
Parameters:
fn: A function containing multiple state updatesReturns: The return value of fn
Example:
Creates a function that runs when specified dependencies change. Similar to useEffect but returns a function that can be used in other contexts.
Type:
Parameters:
deps: A single getter or an array of getters that the effect depends onfn: A function that runs when dependencies change. It receives the current values, previous values, and previous return valuedefer: Optional flag to defer the first run until the next update cycleReturns: A function that can be used as a callback in other effects or computations
Example:
Creates a new untracked owner scope that doesn't automatically dispose. Useful for nested reactive scopes that shouldn't be disposed when their parent recomputes. Ensures all memory and computations are properly managed.
Type:
Parameters:
fn: The function to execute within the root context. It receives a dispose function as an argumentdetachedOwner: Optional owner context to attach toReturns: The return value of fn
Example:
Gets the current owner context. The owner context is responsible for managing the lifecycle of computations and effects.
Type:
Returns: The current owner or undefined if none
Example:
Runs a function within a specific owner context. This allows you to create computations or effects that are managed by a specific owner.
Type:
Parameters:
owner: The owner context to usefn: The function to runReturns: The return value of fn
Example:
Maps an array to a new array with efficient updates by tracking each value's identity. This is the underlying function for the <For> component.
Type:
Parameters:
list: A getter function that returns the array to map or a falsy valuemapFn: A function that maps each item to a new value, receiving the item and a reactive indexfallback: Optional function that returns fallback content when the array is emptyReturns: A getter function that returns the mapped array
Example:
Maps an array to a new array with efficient updates by tracking changes to array indices. This is the underlying function for the <Index> component.
Type:
Parameters:
list: A getter function that returns the array to map or a falsy valuemapFn: A function that maps each item to a new value, receiving a reactive getter for the item and the static indexfallback: Optional function that returns fallback content when the array is emptyReturns: A getter function that returns the mapped array
Example:
Merges multiple props objects into a single reactive object. Properties from later sources override earlier ones. Useful for setting default properties for components when callers don't provide them.
Type:
Parameters:
sources: Multiple props objects or functions that return props objectsReturns: A merged object with reactive properties
Example:
Splits a props object into multiple objects based on specified keys. Useful for separating props for different components or hooks.
Type:
Parameters:
props: The props object to splitkeys: Arrays of keys to extract into separate objectsReturns: An array of objects with the extracted props and remaining props
Example:
Executes a function and catches any errors that occur, passing them to an error handler. Useful for isolating error handling within specific parts of your application.
Type:
Parameters:
fn: The function to executehandler: A function to handle any errorsReturns: The return value of fn if no error occurs
Example: