【发布时间】:2018-10-09 21:06:41
【问题描述】:
我正在尝试在 Highchart 中返回 graphql 数据。不知何故,它没有被显示。观看现场演示here。
import React from "react";
import { Query } from "react-apollo";
import Highcharts from "highcharts";
import { ExchangeRates, client } from "./query";
class OtherComponentTest extends React.Component {
componentDidMount() {
<Query query={ExchangeRates} client={client}>
{({ loading, error, data }) => {
if (error) return <h1>Error...</h1>;
if (loading || !data) return <h1>Loading...</h1>;
return Highcharts.chart("production", {
...
});
}}
</Query>;
}
render() {
return (
<div>
<div id="production">loading </div>
</div>
);
}
}
export default OtherComponentTest;
我错过了什么?
【问题讨论】:
标签: reactjs highcharts apollo