
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
effective-state
Advanced tools
A minimalist reactive programming library that provides fine-grained reactivity primitives for TypeScript applications. It offers a signals-based approach where you create reactive atoms (state containers), derive computed values, and react to changes through effects—all with automatic dependency tracking and optimal re-computation.
Unlike heavier frameworks, effective-state focuses solely on the reactive core: atoms hold state, computed values derive from other reactive sources, and effects run side effects when dependencies change. This makes it perfect for building reactive UIs, state management systems, or any application requiring efficient change propagation.
npm install effective-state
You can run tests written in TypeScript directly with Node.js 22+:
node --experimental-transform-types --test src/index.test.ts
import { atom, computed, effect } from 'effective-state';
// Create an atom
const count = atom(0);
// Create a computed value
const double = computed(() => count() * 2);
// React to changes
effect(() => {
console.log(`Count is ${count()}, double is ${double()}`);
});
count(5); // Logs: Count is 5, double is 10
const value = atom(10);
value(20); // set new value
console.log(value()); // get current value
Tip: In TypeScript, always use the function-call style to get the value of an atom or computed. For example:
const a = atom(2);
const b = atom(3);
console.log(a() + b()); // 5
console.log(`Value is: ${a()}`); // "Value is: 2"
const a = atom(2);
const b = atom(3);
const sum = computed(() => a() + b());
a(5);
console.log(sum()); // 8
const name = atom('Alice');
effect(() => {
console.log('Hello,', name());
});
name('Bob'); // Logs: Hello, Bob
const n = atom(1);
const unsubscribe = n.subscribe((val) => {
console.log('n changed to', val);
});
n(2); // Logs: n changed to 2
unsubscribe();
n(3); // No log
const user = atom({ name: 'Alice', age: 30 });
effect(() => {
console.log(user().name);
});
user({ ...user(), name: 'Bob' }); // Logs: Bob
atom<T>(initialValue: T): Atom<T>Creates a reactive atom holding a value. Minimal API:
atom() to read, atom(newValue) to write.subscribe(callback) to listen for changes (optional)computed<T>(fn: () => T): Computed<T>Creates a computed value that updates when dependencies change.
effect(fn: () => void): () => voidRuns a function whenever its dependencies change. Returns an unsubscribe function.
MIT
FAQs
Minimal, fast, type-safe reactive primitives for TypeScript
We found that effective-state demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.