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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Flatstore, simplified state across ReactJS components, suck it redux

3 点作者 JoeOfTexas超过 2 年前
I&#x27;ve been using this on my projects since 2019, and it&#x27;s made my life so much easier sharing and reacting to state changes across components.<p>Redux has made life a living hell at my job trying to follow code trails for debugging.<p>In any case, its great for personal projects. The code is very lightweight at about 300 lines and zero dependencies.<p>flatstore unofficially supports history with undo&#x2F;redo, but I haven&#x27;t used it much. The hook `useWatch` is the latest update for function components to track state changes. If you still use legacy class components, it uses a similar HOC approach as redux for state changes.<p>But I recommend converting to functional components asap, as it shrinks code a lot, and you just need get&#x2F;set&#x2F;useWatch to do anything.

1 comment

niux超过 2 年前
Would you recommend using it in production?
评论 #34315765 未加载