DEV Community

Sui Gn
Sui Gn

Posted on

Winning at State Management

Let me show you something:
TypeScript

`import Me from "this.me";
const me = new Me();

me"@";

me.profile.name("José Abella");
me.profile.bio("Building the semantic web.");

me.users.ana.name("Ana");
me.users.ana.age(22);

me.friends.ana"->";

// One line of magic
me.friends["[i]"]"=";

console.log(me("friends.ana.isAdult")); // → true
console.log(me("friends[age >= 18].name")); // → { ana: "Ana" }
`

That’s it.
No reducers.
No useState + useEffect dance.
No manual memoization.
You just write what the data means, and .me figures out the rest.
Wait, it gets better
You can also hide entire parts of your state like this:
TypeScript

`
me.wallet"_"; // ← this creates a hidden universe

me.wallet.balance(12480);
me.wallet.note("Travel savings");

console.log(me("wallet")); // → undefined
console.log(me("wallet.balance"));// → 12480 (you can still reach inside)
`

The whole wallet is invisible from the outside, but you can still read specific leaves if you know the path.
Why this feels different

You work with natural paths (me.wallet.balance)
Derivations are declared with = (automatic, no extra code)
Privacy is structural — not “I hope the backend doesn’t leak it”
You can ask .me to explain any value: me.explain("friends.ana.isAdult")

It’s like the data has memory and self-awareness.
I’ve been using it as the core of my personal projects and the public reactive part is stupidly fast. Like, “why doesn’t everyone do it this way?” fast.
Obviously it’s still early and has rough edges (especially when secrets are involved), but the core idea clicked for me instantly.
Have you ever felt limited by traditional state management?

Here are the benchmarks:

Top comments (0)