Live data from Hacker News

Application Architecture with React: Rethinking Flux

dialelo.github.io

51–53 of 53 posts

Re: Application Architecture with React: Rethinking Flux

#51
post #47
post #41

Earlier quoted context omitted.

I've actually used a plain state object with UUID version tags saved at each node that needs to be optimized. Whenever the store updates that node, it also updates the version tag with a new UUID. Then shouldComponentUpdate just checks whether the version tag is different before rendering. For my purposes this optimizes at least as well as ImmutableJS, and there is no overhead from loading and using a dedicated libra…

Your approach sounds interesting. Ever write about it? The undo / redo gains of ImmutableJS quickly vanish when you're working with remote data and the leaked getters aren't fun. A little UUID juggling is worth it if it allows my components/reducers to work with plain old javascript objects and still get fast shouldComponentUpdates.

It's one of the ideas for shouldComponentUpdate that I wrote about here, but it's not described in a lot of detail:

http://guscost.com/2015/05/27/react-js-and-flux-ideas-for-pr...

One of these days I'll put up another piece on Flux/React, and an example application to demonstrate an approach that doesn't have a lot of dependencies (not even ES6, for example).

Also I have not run into any pitfalls using ImmutableJS yet apart from the extra overhead, so thanks for the heads up.

Re: Application Architecture with React: Rethinking Flux

#52
post #22

If you're going to borrow every idea from ClojureScript and Om, why not simply switch to these technologies instead of relying on so many libraries?

Because parenthesis.

That's the most common objection, and it's the one that makes the least sense. If we were to count the number of parenthesis + square brackets + curly braces, we would fine that there is not more symbols in a LISP, just that they are arranged differently.

Re: Application Architecture with React: Rethinking Flux

#53
post #45

Earlier quoted context omitted.

Slightly off topic, but what library do you use for networking with React? Almost every code sample or tutorial uses jQuery's AJAX methods. Bundling jQuery seems excessive when just using those methods, but is there not a reliable alternative?

There's tons, but the common one is fetch: https://github.com/matthew-andrews/isomorphic-fetch

Yeah I use fetch and a Redux React promise middleware module.
Post reply on HN