Skip to main content

Overview

reatomString creates an atom that manages string state with a built-in reset method to return to the initial value. It supports optional type inference for literal string types.

Import

Type Signature

Parameters

string
default:"''"
The initial string value
string
default:"'stringAtom'"
Optional name for the atom, useful for debugging

Methods

reset

Resets the string to its initial value. Returns: T - The initial value

Basic Usage

Advanced Usage

Form Input Management

Literal String Types

Search Query State

Text Editor State

URL Parameter Management

Validation with Computed

Using with Atom Methods

Since StringAtom extends Atom, you can use standard atom methods:

Notes

  • The atom preserves literal string types when provided
  • Default initial value is an empty string ''
  • reset() always returns to the value provided during creation
  • All state changes trigger reactive updates
  • Direct assignments will not work; always use set() or other atom methods
  • Unlike other primitives, reatomString only provides a reset method as strings are immutable and don’t need specialized mutation methods