Reactive Utilities

createRoot

Edit this page
function createRoot<T>(fn: (dispose: () => void) => T): T

Creates a new non-tracked owner scope that doesn't auto-dispose. This is useful for nested reactive scopes that you do not wish to release when the parent re-evaluates.

All Solid code should be wrapped in one of these top level as they ensure that all memory/computations are freed up. Normally you do not need to worry about this as createRoot is embedded into all render entry functions.

Report an issue with this page