Answer the question
In order to leave comments, you need to log in
Can't call state?
There is a state
constructor() {
super();
this.state = {
data: {},
trainer: [],
diagram: this.chartData(),
};
}
chartData() {
console.log(this.state.data.boys);
return {
labels: ['Boys', 'Girls'],
datasets: [
{
label: 'My First dataset',
fillColor: 'rgba(220,220,220,0.2)',
strokeColor: 'rgba(220,220,220,1)',
pointColor: 'rgba(220,220,220,1)',
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: 'rgba(220,220,220,1)',
data: [3, 0],
},
]
}
}
Answer the question
In order to leave comments, you need to log in
constructor() {
super();
this.state = {
data: {},
trainer: [],
diagram: this.chartData(),
};
this.chartData=this.chartData.bind(chartData)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question