4 ms·
Seems like React does (some of) the same stuff as d3, at least w/r/t mapping DOM objects onto data. What does d3 add over React, other than some utilities for
by chrisdevereux 11y ago
Seems like React does (some of) the same stuff as d3, at least w/r/t mapping DOM objects onto data.
What does d3 add over React, other than some utilities for producing scales, etc?
- krcz 11y agoIt allows you to change the data and group elements into new ones (existing in the data but not in DOM), updated (existing both in the data and DOM) and removed ones (only in DOM). Then it lets you to do some cool stuff on them, like transitions: http://bl.ocks.org/mbostock/3808218 http://bl.ocks.org/mbostock/3808218 http://bl.ocks.org/mbostock/3808221 http://bl.ocks.org/mbostock/3808221 http://bl.ocks.org/mbostock/3808234 http://bl.ocks.org/mbostock/3808234
- eterm 11y agoD3 has some really nice stuff for doing transitions, I could imagine that being a lot more difficult to get right just using react.
- illicium 11y agoD3 is really a half-DOM, half-visualization algorithm library, but the latter is much more than a few utility functions. For example, D3's layouts (https://github.com/mbostock/d3/wiki/Layouts https://github.com/mbostock/d3/wiki/Layouts) which you can use independently of its DOM renderer.
- findjashua 11y agod3 computes the svg attributes (data) that react renders onto the dom
- weego 11y agoWhy don't we just take that statement to the logical conclusion of boiling it down to "javascript does some of the same stuff that D3 does". I mean yeah, you can write everything that D3 does yourself, but React isn't actually doing anything here. You could swap React for Angular/Backbone in this situation and you'd still be the guy ignoring almost everything we're learned from leveraging open source projects over the last 20 years.