Fetch/then vs queue/defer

I’ve been using fetch/then in the first couple d3 visualization challenges but now that I’m getting to the chloropleth map challenge it looks like the examples I see are all using queue/defer to load the data. Is there a best practice or is the queue/defer used for larger (so longer to load)/multiple datasets?

Nevermind… just realized queue defer has been depreciated for promise.all.

One of the issues with D3 stuff online (including FCCs) is that D3 has been around for a long time (edit: it was first released a year after the 5th edition spec of JavaScript was published – i.e. when things like JSON.parse and array methods such as map and filter were added – and a year before that was fully, officially realised. Promises didn’t exist, and neither did fetch). And in that time it’s gone through heavy development, with several major changes to parts of its API. So you’ll find quite a lot of stuff talks about things that have been deprecated as JavaScript (the language itself) has developed and had features added to it, and as best practices for writing JS code have evolved. Almost all the information in tutorials like this still applies, but you are going to have to figure out how to translate to newer APIs – once a system has been built on one major version of a library (as is the case with the examples for [some of] the D3 part of the curriculum), it’s often very difficult to change it, unfortunately.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.