What are Signals and how do they work?
mainSignals is a lightweight (~1kB minzipped) reactivity API designed to provide reactive observables for UI libraries. It follows a "lazy principle" similar to Svelte, ensuring that work is only performed when necessary.
Core Features:
- Reactive Observables: Store state and create computed properties.
- Lazy Evaluation: Computations only re-run when their dependencies change.
- Batched Updates: Uses a microtask scheduler to batch updates.
- Change Detection: Only triggers updates when a value has actually changed.
- Environment Agnostic: Works in both browsers and Node.js.
- Strongly Typed: Built with TypeScript for full type safety.