I'm trying to load some data to a chart using https://github.com/oksktank/react-native-pure-chart Trying to load Json data from api but seem to get undefined only, what might be the problem?
constructor(props){
super(props);
this.state = { isLoading: true}
}
componentDidMount(){
return fetch('https://api.mockaroo.com/api/12a7ead0?count=20&key=8ba88000')
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource: responseJson.Weight,
}, function(){
});
})
.catch((error) =>{
console.error(error);
});
}
render() {
return (
<SafeAreaView style={{flex:1}}>
<PureChart data={this.state.dataSource} type='line' />
</SafeAreaView>
);
}
}