所以,在我点击提交按钮后,什么都不会发生。我不确定查询是否正在执行。如果是,如何在浏览器中显示结果?
提交按钮
handleSubmit(event) {
event.preventDefault();
console.log(this.state.inputValue)
this.state = {
inputValue: new Date(document.getElementById("time").value).valueOf()
};
ObjectQuery({
variables: {
timestamp: this.state.inputValue
}
});
}查询组件
import gql from "graphql-tag";
export function ObjectQuery() {
gql`
query($timestamp: Float!) {
action(timestamp: $timestamp) {
action
timestamp
object {
filename
}
}
}
`;
}
export default ObjectQuery;发布于 2018-08-15 13:30:04
您需要在您的gql函数中返回ObjectQuery
我为你的问题写了一个简单的演示。您可以检查这个:https://codesandbox.io/s/n7vqnovl8l
https://stackoverflow.com/questions/51642739
复制相似问题