Export Code
Connected
index.js
import ReactDOM from 'react-dom'
import { SVGContainer } from './SVGContainer'
import CirclePlot from './CirclePlot'

//Define a root element that React will attach sub elements to
const root = document.getElementById('app')

//The app component will hold all subcomponents belonging to it
const App = () => (
<SVGContainer
width={900}
height={500}
x={60}
y={20}
>
<Title text={'An atypical 3D plot of students eye colors'}></Title>
<CirclePlot node={root} width={900} height={500}/>
</SVGContainer>
)

//A single line component that creates a text element holding our title
const Title = ({titleText}) => <text>{titleText}</text>

console.log({App})
//render the app component
ReactDOM.render(<App />, root)

React + D3 Hooks template

Laurens

Last edited Nov 23, 2020
Created on Sep 17, 2020
Forked from Hello VizHub

React + D3

Purpose

To provide an understandable React + D3 template. This version uses the new React hooks.

Trying to adapt using this

Questions

  • How can a wrapped element get the id of the wrapper element?
  • How does it work when we want to update the graph
MIT Licensed