I'm using the third party component react-sparklines for a project. However, when I import it to my component as shown below it throws the following error: Uncaught TypeError: Super expression must either be null or a function, not undefined. But when I take it out, the error goes away and the app runs smoothly.
import React, {Component} from 'react';
import {connect} from 'react-redux';
import { Sparklines, SparklinesLine } from 'react-sparklines';
class WeatherList extends React.Component{
renderCity(cityData){
const name = cityData.city.name;
const temps = cityData.list.map(weather => weather.main.temp);
return (
<tr key={name}>
<td>{name}</td>
<td>
<Sparklines data={[5, 10, 5, 20]}>
<SparklinesLine color="blue" />
</Sparklines>
</td>
</tr>
);
}
}
function mapStateToProps(state){
return { weather: state.weather };}
export default connect(mapStateToProps)(WeatherList);
Please note I knowingly left out the render()
function. Here's the link to Sparklines: https://github.com/borisyankov/react-sparklines
Any help will be appreciated!
Version 1.7.0 of Sparklines has a bug. Consider downgrading to a lower version, in this case version 1.6.0:
npm r react-sparklines
npm i --save [email protected]
You might want to get more information here: https://github.com/borisyankov/react-sparklines/issues/89
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With