ReactJS query variables

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


ReactJS query variables



Not sure what I am doing wrong but I receiving the following error message after I click on the submit button:



The code for query is as follows:


const ObjectQuery = gql`
query($timestamp: Float!){
action(timestamp: $timestamp){
action
timestamp
object{
filename
}
}
}


`;

class UserList extends React.Component {
render() {

return (

({ loading, error, data }) => {
if (loading) return <p>Loading...</p>;
if (error) {
console.log(error);
return <p>Error</p>;
}

if (data.action.length === 0) return <div>No Objects</div>;

return (//this code binds the query above to the output and puts it on the screen.
<Item.Group divided>
{data.action.map(action => (
<div>
<ul>
<li key = {action.action}>{action.action}</li>
<li key = {action.timestamp}>{action.timestamp}</li>
<ul>
{action.object.map((obj) => {
return (<li>{obj.filename}</li>)
})}
</ul>
</ul>
</div>
))}
</Item.Group>
);
}

)};
}
export default graphql(ObjectQuery, {
options: (props) => ({variables: {timestamp: props.timestamp}})
})(UserList);



This is the code for the submit button. Also, for some reason the import statement is grayed out.


import ObjectQuery from '../UserList';

handleSubmit(event) {
event.preventDefault();
console.log(this.state)
this.setState({ inputValue: new Date(document.getElementById("time").value ).valueOf() });
this.props.ObjectQuery({
variables:{
timestamp: this.state.inputValue
},

});

}









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results