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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

React, Automatic Redux Providers, and Replicators

5 点作者 tfb超过 9 年前

2 条评论

tfb超过 9 年前
There seem to be a lot of similar questions about how to reduce redux&#x27;s boilerplate and build something real-world with it. I think I found a pretty good solution (among other things) which I wrote about within this article.<p>TL;DR: You can create redux providers that automatically match themselves to your components based on their propTypes. All you really need is a components directory, a providers directory, and an optional but recommended themes directory. Everything is easily interchangeable, understandable, maintainable, extendable, and reusable. There&#x27;s a lot more included with all that like hot reloading both client and server, server rendering, etc., etc., etc. I built an app from scratch based on the included boilerplate yesterday and it took about 10 minutes as opposed to the 1 hour it would usually take!
ivan_ah超过 9 年前
Very interesting write-up. Definitely cuts down on the boilerplate.<p>Would be good to explain what `react-redux-provide` does under the hood. It might help convince redux users that the package is doing some of the work for them.<p>Also what would the code look like without the @provide decorator? [Stick to ES6, it&#x27;s already crazy enough, no need to jump to ES7 stuff]
评论 #11099222 未加载