DEV Community

Jordan Tauscher
Jordan Tauscher

Posted on

# EIS.js: The Tiny State Store That's Making Waves in 2025 🌊

State management in web applications has long been dominated by heavyweight solutions like Redux, MobX, and Zustand. But what if I told you there's a new player in town that's both incredibly powerful and refreshingly simple? Meet EIS.js a tiny, framework-agnostic state store that's changing how developers think about state management.

What Makes EIS.js Special?

EIS.js is a tiny, framework-agnostic state store for the web that's simple, reactive, and immutable, working seamlessly with vanilla JS, React, Vue, Svelte, and Node.js. But don't let its small size fool you – this library packs some serious features into just a few kilobytes.

Core Features That Stand Out

πŸ”’ Deep Immutability by Default
State is always frozen to prevent accidental mutations, with recursive freezing of all nested objects for deep immutability. No more debugging mysterious state mutations!

⚑ Modern Cloning Strategy
Uses structuredClone if available, falls back to JSON.parse(JSON.stringify(...)) to ensure state updates are truly immutable. This means you get the best performance on modern browsers while maintaining compatibility.

🎯 Dead Simple API
Only three methods: get, set, and subscribe. That's it! No complex reducers, no boilerplate, no learning curve.

Latest Features & Improvements

The recent updates to EIS.js show a library that's maturing rapidly:

Enhanced Error Handling

New _isSerializable helper for better error handling means you'll get clearer feedback when something goes wrong with your state updates.

Improved Robustness

Recent fixes ensure that _freeze now properly handles arrays and already frozen objects, and doesn't attempt to freeze top-level or nested primitive data types.

Developer Experience Improvements

The set method now passes a cloned state to updater functions (no need to spread state into a new object before), making your code cleaner and more intuitive.

Real-World Usage Examples

Vanilla JavaScript

import eis from '@taujor/eis';

const [get, set, subscribe] = eis({ count: 0 });

// Subscribe to changes
const unsubscribe = subscribe((state) => {
  console.log('State changed:', state);
}, true);

// Update state
set({ count: 1 });
set((state) => ({ count: state.count + 1 }));

// Get current state
console.log(get()); // { count: 2 }
Enter fullscreen mode Exit fullscreen mode

React Integration

import { useEffect, useState } from 'react';
import eis from '@taujor/eis';

const [get, set, subscribe] = eis(0);

function Counter() {
  const [count, setCount] = useState(get());

  useEffect(() => {
    const unsubscribe = subscribe((newState) => {
      setCount(newState);
    }, true);

    return unsubscribe;
  }, []);

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => set(state => state + 1)}>
        Increment
      </button>
    </div>
  );
}
Enter fullscreen mode Exit fullscreen mode

When Should You Use EIS.js?

EIS.js shines in several scenarios:

  • Small to Medium Apps: Perfect when Redux feels like overkill
  • Framework Agnostic Projects: Works everywhere without vendor lock-in
  • Learning Projects: Minimal API makes it great for understanding state management
  • Performance-Critical Apps: Tiny bundle size and optional dev mode for production optimization

Performance Considerations

Like any tool, EIS.js has trade-offs. Deep cloning and freezing can be slow for very large state objects, so it's recommended to keep them small or use multiple local stores instead of a single global store. However, the new dev mode option (eis({your: "state"}, {dev: false})) disables cloning/freezing in production for better performance.

The Bottom Line

In 2025, developers are increasingly favoring simplicity over complexity. EIS.js represents this trend perfectly – it gives you powerful state management without the cognitive overhead of larger libraries.

Whether you're building a simple dashboard, a complex SPA, or experimenting with new frontend frameworks, EIS.js offers a refreshing approach to state management that just works.

Getting Started

npm install @taujor/eis
# or
yarn add @taujor/eis
Enter fullscreen mode Exit fullscreen mode

Or try it via CDN:

import eis from 'https://unpkg.com/@taujor/eis/eis.js'
Enter fullscreen mode Exit fullscreen mode

Ready to simplify your state management? Give EIS.js a try – your future self will thank you for choosing simplicity over complexity.


Have you tried EIS.js in your projects? Share your experiences in the comments below! πŸ‘‡

Links:

Top comments (0)