TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Vaettir-React – Control Inverting Agent Library for React Apps

1 点作者 valand超过 1 年前
A few years ago, I needed a module to maintain a complex and multi-layered application state of a react-based desktop app and its underlying infra. Then I realized I needed more than a passive state-management lib --Turing complete and concurrent agents capable of resolving the chaotic asynchronous inputs and signals.<p>Vaettir is an agent writing library, and Vaettir-React binds the agents to invert the control of a React application. Instead of piping user-generated events into `setState` and `useEffect` hooks (which often grow unmaintainable past a certain complexity threshold), Vaettir agents can optionally run on their own, typically by means of async loops. It is written similarly to multi-threaded programs written in lower-level languages. A simple abstract example is an agent that pools concurrent user and network events (e.g. clicking things while the app is fetching for something), merging these incoming requests, and then processing them sequentially.<p>Vaettir agents can be passed into many components either via props or context. As a side-effect, it can be used as a state-management library with flexible scoping. Its custom channels can be subscribed by different React components, allowing for semantically meaningful selective re-rendering. Last but not least, provided optional hooks bind the agent&#x27;s and the component&#x27;s lifetime (i.e. when mounted, the agent is created; when unmounted, the agent is destroyed), optionally with a `[dependency, array]` style of `useEffect` hooks.

暂无评论

暂无评论