r/javascript • • Aug 27 '15

Stop Using React for EVERYTHING!

https://medium.com/@zackargyle/stop-using-react-for-everything-c8297ac1a644
3 Upvotes

131 comments sorted by

View all comments

3

u/dwighthouse Aug 27 '15

Cool story bro. Tell us how you really feel. Reminds me of all the articles saying we shouldn't use JS for EVERYTHING from a few years ago. (Just use HTML and CSS!) Since React is a generic, functional render framework, I think is is appropriate for anything that needs to render more than once on a webpage, even if that thing is SVG or canvas. Overkill? Sure, sometimes, but if your goal is to get the ineraction done as quickly as possible, the 'cost' of using react is negligible.

2

u/Poop_is_Food Aug 27 '15

react rendering canvas? I call shenanigans. I mean it can append a <canvas>, but it can't actually draw anything right?

4

u/ub3rgeek Aug 27 '15

2

u/Poop_is_Food Aug 27 '15

ahh so they replicated a tiny subset of HTML/CSS that renders from react virtual dom to canvas. For something reason I thought you meant something else.

2

u/dwighthouse Aug 28 '15

React core is just a way of defining a structured hierarchy with automatic diffing and lifecycle hooks. You could target webgl, svg, html, css, native ios, etc. there already exist several projects that do. It's not necessarily emulating a subset of HTML/CSS. It can operate on any set of primitives that are representable as a structured hierarchy. http://facebook.github.io/react/blog/2015/07/03/react-v0.14-beta-1.html

2

u/[deleted] Aug 28 '15

Im picturing a totally from the ground up webgl project where they wrote their own shaders and everything... also using react for data updates ... then i'm picturing getting hired by that company and looking at that code base for the first time ..... then i'm picturing drinking ... allot

3

u/dwighthouse Aug 28 '15

It's called a scene graph. Most 3d packages and game engines have them. A 3d scene definable in terms of tags (scene objects), attributes (animation and behavior functions), and styles (materials) would be a breath of fresh air by comparison.

1

u/Poop_is_Food Aug 28 '15

would it be fair to call these things "extensions" of react?

2

u/dwighthouse Aug 28 '15

The concept is so new, no-one has a firm name for them yet. However, they are, by definition, "render targets," so I think that name is appropriate. Just like game engines have platform targets (xbox, pc, mac, etc).

3

u/html6dev Aug 28 '15

Indeed react can basically target anything. Netflix also forked it and made it to target a native view layer they created for their apps running on things like blueray players o_O there is a talk on YouTube about it that I'll try to locate but it's worth searching out. Really clearly points out the things this article misses about the benefits of react. For lack of a less buzzy word it's a complete paradigm shift in how we develop. It's also the reason react native has taken off so quickly. The ideas are universal.