...

/

Asynchronously load data

Asynchronously load data

Great! We have a preloader. Time to load some data.

We’ll use D3’s built-in data loading methods and tie their callbacks into React’s component lifecycle. You could talk to a REST API in the same way. Neither D3 nor React care what the datasource is.

First, you need the data files. I scraped the tech salary info from h1bdata.info, the median household incomes from the US census datasets, and US map data from Mike Bostock’s github repositories. I used some elbow grease and python scripts to tie the datasets together.

You can read about the scraping on my blog here, here, and here. But it’s not the subject of this book.

Step 0: Get the data

You should download the 6 datafiles from the step-by-step repository on Github. Put them in the public/data directory in your project.

First, you need the data files. I scraped the tech salary info from h1bdata.info, the median household incomes from the US census datasets, and US map data from Mike Bostock’s Github repositories. I used some elbow grease and python scripts to tie the datasets together.

You can read about the scraping on my blog here, here, and here. But it’s not the subject of this book. ...

Access this course and 1400+ top-rated courses and projects.