The results were interesting: the system hit 100% Basis Efficiency (mathematical rank of 12/12), but the causality engine flagged a 'Double Render Cycle' in the use-mobile hook where state was being manually synchronized within an effect.
It's a good example of how a system can be mathematically sound (no redundant state) but still have execution-level bottlenecks that are invisible to static analysis.
Just pushed v0.2.3 with full React API parity and 100% test coverage on hooks.
lpetronika•1mo ago
I’ve been a software engineer for 10 years. For a long time, I viewed "application state" as just a collection of variables and logic. I was effective, but I felt like I was missing the underlying structure of why state becomes messy.
Recently, I started studying linear algebra (Axler’s "Linear Algebra Done Right"). It opened a "third eye" for me. I realized that redundant state in a React app is essentially "linear dependence." If two or more state variables always update in perfect sync, they aren't adding new information-they are just redundant dimensions in your application's state space.
I spent my holiday break building react-state-basis. It’s a real-time architectural auditor that monitors your state transitions as vectors to find these redundancies.
What the tool does:
Redundancy Detection: It identifies state variables that move in perfect synchronization (collinear) and suggests refactoring them into a single source of truth or a derived value (useMemo).
Causality Tracking: It traces useEffect chains to find "Double Render Cycles" where one state update unnecessarily triggers another.
Infinite Loop Protection: It includes a "Circuit Breaker" that detects high-speed oscillations and halts execution before the browser thread locks up.
System Health Score: It analyzes your entire state architecture to give you an efficiency score based on how many variables are actually independent.
I built a Babel plugin to handle automatic labeling, so you don't have to manually name your states. It’s designed as a development-time tool—you can easily swap back to standard React imports for your production build.
I’m a solo dev and this is my first open-source project. I’d love to hear what you think about this approach to state auditing.
https://github.com/liovic/react-state-basis