the response of @Daniel forced me to think a little more and i came to the following conclusion which ill try to explain.
For example i have the following type:
type Car{
brand:String
power:String
doors:Int
color:String
}
and a query:
type Query {
car: Car
}
So if i, on the client-side want to ask for the car. I can do it this way:
fetch('http://url:port', {
methode: 'post',
headers: {...headers}
body: JSON.stringify({ query: `
car{
brand
color
power
doors
}
`})
}).then(res => res.json()).then(res=>console.log(res.data));
this will result in all the attributes of my car. So now if i like to use the fragments. I will do:
fetch('http://url:port', {
methode: 'post',
headers: {...headers}
body: JSON.stringify({ query: `
car{
...wholeCar
}
fragment wholeCar on Car{
brand
color
power
doors
}
`})
}).then(res => res.json()).then(res=>console.log(res.data));
The key thing to understand was that i need to define the fragment within the query, on the client and not on the server.