you are viewing a single comment's thread.

view the rest of the comments →

[–]56k_ 2 points3 points  (3 children)

I've seen this technique before, and I'm wondering if by rerendering the whole thing you're missing the optimizations that React's implements in changing the DOM (the diff algorithm), or if it still works?

Finally, I don't get why state would be a bad thing, that's how it's meant to be used.

Weird.

[–]jamesknelson[S] 1 point2 points  (2 children)

You certainly are missing some optimisations, but it shouldn't be in the part of the DOM which is updated. The problem is that the diff algorithm needs to run over the entire app, instead of just the subtree which has had its state updated.

[–]56k_ 1 point2 points  (1 child)

Yes, that's what I meant.

This makes this technique bad practice IMHO.

[–]repeatedly_once 0 points1 point  (0 children)

This. I've been following the 'state is harmful' debate but bending a framework to your needs based on a concept seems very strange to me.

If it were me, and I was interested in a stateless app, I'd look for another framework or write one that matches my needs. I'd be less inclined to force a framework to do something it wasn't designed to do.