I am trying to use chartist.js with my react component.I am not able to show Pie chart in my react component.
Chartist.js -> https://gionkunz.github.io/chartist-js/getting-started.html
Pie.js:
import React, { Component } from 'react';
var data = {
// A labels array that can contain any sort of values
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
// Our series array that contains series objects or in this case series data arrays
series: [
[5, 2, 4, 2, 0]
]
};
// Create a new line chart object where as first parameter we pass in a selector
// that is resolving to our chart container element. The Second parameter
// is the actual data object.
const mychart = new Chartist.Line('.ct-chart', data);
class Pie extends Component {
render(){
return(
<div>
<div class="ct-chart ct-perfect-fourth">
{mychart}
</div>
</div>
)}
}
export default Pie;
Parent component:
render(){
return(
<div>
<Pie/>
</div>
)
}
I am importing Pie.js inside my parent component but I am getting error saying objects should be array and not objects i.e objects are not valid react child. see screenshot:

class="ct-chart". since its JavaScript,classis a reserved work andclassNameshould be used insteadPieis undefined in your first codeblock. did you meanChart?