004 - Getting D3.js Running

Date: May 20th 2020

Some text that I want to change red...

Using D3 and React. D3 is used mostly for doing calculations on the data and React deals with the DOM. In the few instances for Transitions, Axises and Brushing where D3 needs to access the DOM then we can switch.

D3 is more than enough for simple interactions, like click or hover. React comes in when you want to interact more and effect their state. Or link multiple parts of a visualization together.


To set up D3 in my react environment, first install d3.js

npm install d3

D3 can then be called into a react component using:

import * as d3 from "d3";

Example 1