Lifecycle & Actions

refresh

Invalidates one reactive source, forcing it to re-execute even if its inputs haven't changed.

Pass either a Solid-created accessor or a projected store created from createStore(fn, ...) / createProjection(...). refresh() is a write-like invalidation operation: it does not read the target's value, and refreshing a plain signal accessor is a no-op.

Use it to invalidate cached async values (e.g. Force a re-fetch) without tearing the consumer down.


Import

import { refresh } from "solid-js";

Type signature

function refresh<T>(target: Refreshable<T>): void;

Examples

const user = createMemo(async () => fetch(`/users/${id()}`).then(r => r.json()));
// Re-fetch on demand
<button onClick={() => refresh(user)}>Reload</button>
Last updated: 7/4/26, 6:21 PMEdit this pageReport an issue with this page