
Vibe coding isn’t just AI-assisted chaos. Here’s how to avoid insecure, unreadable code and turn your “vibes” into real developer productivity.

GitHub SpecKit brings structure to AI-assisted coding with a spec-driven workflow. Learn how to build a consistent, React-based project guided by clear specs and plans.

:has(), with examplesThe CSS :has() pseudo-class is a powerful new feature that lets you style parents, siblings, and more – writing cleaner, more dynamic CSS with less JavaScript.

Kombai AI converts Figma designs into clean, responsive frontend code. It helps developers build production-ready UIs faster while keeping design accuracy and code quality intact.
Hey there, want to help make our blog better?
Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.
Sign up now
3 Replies to "GraphQL variables in simple terms"
Testing variables in some application is pretty straightforward. However, how do you use variables in a standard fetch call using code?
In the body of the request stringify your graphql query like this:- hope it helps
fetch(‘https://api.hashnode.com’, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
Authorization: ”,
},
body: JSON.stringify({
query:
‘mutation createStory($input: CreateStoryInput!){ createStory(input: $input){ code success message } }’,
variables: {
input: {
title: ‘What are the e2e testing libraries you use ?’,
contentMarkdown: ‘# You can put Markdown here.\n***\n’,
tags: [
{
_id: ‘56744723958ef13879b9549b’,
slug: ‘testing’,
name: ‘Testing’,
},
],
coverImageURL:
‘https://codybontecou.com/images/header-meta-component.png’,
},
},
}),
})
.then(res => res.json())
.then(res => console.log(JSON.stringify(res)))
Thank you! After endless hours trying to use string interpolation to inject my $token into the GraphQL request and having to deal with needing to escape quotation mark characters, this helped me correctly use variables for my request.