Here's an idea:
A front-end architecture for React apps with simple decentralized stores and explicit rendering control.
As an experiment (worked out together with Gemini AI), this should be a practical and very performant realization of the Functional Core, Imperative Shell (FCIS) architecture for a TypeScript front-end in React:
-
We avoid using most React hooks (aka. side-effects), such as
useState,useReducer,useContext,useMemo/useCallback, anduseEffect. -
We let React be strictly and only responsible for the View layer (the Functional Core), and for the Imperative Shell we use decoupled Stores (aka. ModelControllers: state + logic) colocated alongside the view Components. Our API becomes a simple
useStore(to wire it up, so we can use React's component tree for structure, and don't have to replicate it in the Imperative Shell), and a general `triggerAction(action, payload)