Simple React State Management

Daniel Payne
1 min readJun 12, 2023

Use hooks to share state in React applications

● Single line state management

● Share state in an email

● Share state across browser tabs

You can try out this demo at http://keldan.org.uk/statemutex

npm i @keldan-systems/state-mutex

If you want to write one liner state management control code.

I have tried all the other state management techniques, and they are too complex for simple UI management and too simple for business management logic. I want simple one-liner state management for my UI and keep all the complex business logic in a database, where it belongs.

If you want to share state via an email.

I often need users to email support issues in, and when I keep the state in the URL. The users can send me that text and I can put my browser into the same state with a simple cut & paste.

If you want to share state across browser tabs.

I am often writing complex financial management application that are spread across several screens. I need those screens to share state, so that one can act as a control window and another can display detailed information. I don’t want to use a server to orchestrate the communication between the windows.

The State Mutex has been tested with Create React App, Vite, NextJS and RemixJS.

With Remix you will need to add this to your remix.config.js

serverDependenciesToBundle: ["@keldan-systems/state-mutex"],

--

--

Daniel Payne

Developer specialising in JavaScript based development for the cloud based enterprise.