Hi, I'm working on a reactive project with apollographQL and I'm having problems accessing the properties of the object that comes to me from the graphQl server with the mongodb database. Declare a test object in the same component and if I can access its properties, I really do not know what else to do. I put the code and logs of the console.
The question is: Why can not I access the properties of the object that comes in a data?
--- Component Profile
import React from 'react';
import gql from 'graphql-tag';
import { Query } from 'react-apollo';
const GET_CURRENT_USER = gql'
{
product (_id: "5b6ba3c9c7d76b0f5c7a2c36"){
_id
name
description
}
}
';
//Object for test
const test = {
name: "jhon",
second: "levi"
};
const Profile = () =>
<Query query={GET_CURRENT_USER}>
{({ data }) => {
const { product } = data;
console.log(product)
console.log(test)
return (
<div>
{product.name}
{test.name}
</div>
);
}}
export default Profile;