TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

React Tips and Best Practices

253 pointsby grandpaabout 10 years ago

9 comments

themgtabout 10 years ago
One of the things I didn&#x27;t realize at first was the degree to which Relay&#x2F;GraphQL appear to effectively replace a lot of Flux: <a href="http://facebook.github.io/react/blog/2015/02/20/introducing-relay-and-graphql.html" rel="nofollow">http:&#x2F;&#x2F;facebook.github.io&#x2F;react&#x2F;blog&#x2F;2015&#x2F;02&#x2F;20&#x2F;introducing-...</a><p>Learning Flux sort of seems like learning how to drive stick shift on an &#x27;97 Civic while we wait for the new Tesla to arrive - useful, also a bit annoying. A central store architecture does seem a better match to what Relay will look like though.
评论 #9096459 未加载
评论 #9096627 未加载
评论 #9096807 未加载
评论 #9095928 未加载
ameliusabout 10 years ago
Let&#x27;s be real. It&#x27;s 2015 and we need quite some hoops to get, in most cases, some very simple data rendered on the screen. And even with all those hoops, we are still not sure that it works in all cases. Isn&#x27;t it time for better tools than react? Like functional languages that support incremental computation?
评论 #9095128 未加载
评论 #9095726 未加载
评论 #9095730 未加载
评论 #9096523 未加载
评论 #9095813 未加载
评论 #9096833 未加载
评论 #9098776 未加载
评论 #9096921 未加载
lopatinabout 10 years ago
Great article. One thing I would like to mention is that using component state (this.setState) is <i>okay</i>! Central stores, and the flux architecture, are very helpful but if your state shouldn&#x27;t persist after an unmount, there&#x27;s no point in extracting to a central store and passing it through your entire app as props. (i.e. Whether or not a certain dropdown is expanded). Just keep that state local.
评论 #9096816 未加载
susi22about 10 years ago
Has anybody in the client side community ever made the connection to rules engines? This flow of logic is awfully close to how a rule engine works. I wonder if people will at some point arrive at it.<p>There isn&#x27;t a whole lot of rules engine in JS. Just nools [1] which is huge. I&#x27;d love to see a very simple forward chaining rule engine + Immutable + React and see how that would work out.<p>My guess is that they aren&#x27;t popular at all because they have the notion of being enterprisey (Drools&#x2F;Jboss). I&#x27;m a big fan of them. They &#x2F;can&#x2F; make life &amp; code very nice and elegant. Maybe somebody writes an JS adapter to clara rules [2].<p>[1] <a href="https://github.com/C2FO/nools" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;C2FO&#x2F;nools</a><p>[2] <a href="https://github.com/rbrush/clara-rules" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rbrush&#x2F;clara-rules</a>
评论 #9096063 未加载
评论 #9096217 未加载
netcraftabout 10 years ago
What are the best resources for someone looking to learn react and jsx?
评论 #9095291 未加载
评论 #9095274 未加载
评论 #9095225 未加载
评论 #9096136 未加载
评论 #9096405 未加载
konstruktorabout 10 years ago
Alternatively, there is a very similar example, including a talk, right from the source: <a href="https://github.com/facebook/flux/tree/master/examples/flux-chat" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;flux&#x2F;tree&#x2F;master&#x2F;examples&#x2F;flux-c...</a> <a href="https://facebook.github.io/flux/docs/chat.html#content" rel="nofollow">https:&#x2F;&#x2F;facebook.github.io&#x2F;flux&#x2F;docs&#x2F;chat.html#content</a>
评论 #9096827 未加载
nemothekidabout 10 years ago
With PureRenderMixin, doesn&#x27;t that also prevent child components from updating in response to state changes? For example if a child component must update due to some event, but none of its parents care about that event, doesn&#x27;t that cause the child not to update?<p>Edit: Turns out my render methods aren&#x27;t pure. I query stores right render, which causes problems when using this mixin.
评论 #9098428 未加载
评论 #9097618 未加载
评论 #9098223 未加载
z5habout 10 years ago
These are all excellent points that resonate strongly with my experiences with React. Thanks for the article.
piranabout 10 years ago
Data passed to the controller view should be state from stores, not props. read the docs plz.
评论 #9096839 未加载
评论 #9100314 未加载