atom
See source codeCreates a new Atom.
An Atom is a signal that can be updated directly by calling Atom.set or Atom.update.
function atom<Value, Diff = unknown>(
name: string,
initialValue: Value,
options?: AtomOptions<Value, Diff>
): Atom<Value, Diff>
Example
const name = atom('name', 'John')
name.get() // 'John'
name.set('Jane')
name.get() // 'Jane'
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
Returns
Atom<Value, Diff>
Prev
useViewportHeightNext
computed