Skip to content

Commit da76e20

Browse files
authored
Update example code
1 parent 5036d0a commit da76e20

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ yarn add react-d3-tree
3232

3333
## Usage
3434
```jsx
35+
import React from 'react';
3536
import Tree from 'react-d3-tree';
3637

3738
const myTreeData = [
@@ -58,7 +59,7 @@ const myTreeData = [
5859
},
5960
];
6061

61-
class MyComponent extends Component {
62+
class MyComponent extends React.Component {
6263
render() {
6364
return (
6465
     {/* <Tree /> will fill width/height of its container; in this case `#treeWrapper` */}
@@ -93,6 +94,7 @@ Statically hosted JSON or CSV files can be used as data sources via the addition
9394
### Example
9495

9596
```jsx
97+
import React from 'react';
9698
import { Tree, treeUtil } from 'react-d3-tree';
9799

98100
const csvSource = 'https://raw.githubusercontent.com/bkrem/react-d3-tree/master/docs/examples/data/csv-example.csv';
@@ -113,7 +115,7 @@ componentWillMount() {
113115
.catch((err) => console.error(err));
114116
}
115117

116-
class MyComponent extends Component {
118+
class MyComponent extends React.Component {
117119
render() {
118120
return (
119121
     {/* <Tree /> will fill width/height of its container; in this case `#treeWrapper` */}

0 commit comments

Comments
 (0)