Skip to content

Commit af91828

Browse files
domehead100jerairrest
authored andcommitted
Correction to sample code in ref example (#335)
componentDidMount() should not be contained inside the render() method
1 parent 4904796 commit af91828

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ In order for Chart.js to obey the custom size you need to set `maintainAspectRat
8585
Chart.js instance can be accessed by placing a ref to the element as:
8686

8787
```js
88+
89+
componentDidMount() {
90+
console.log(this.refs.chart.chartInstance); // returns a Chart.js instance reference
91+
}
92+
8893
render() {
89-
componentDidMount() {
90-
console.log(this.refs.chart.chartInstance); // returns a Chart.js instance reference
91-
}
9294
return (
9395
<Doughnut ref='chart' data={data} />
9496
)

0 commit comments

Comments
 (0)