Skip to content

Files

Latest commit

7df524f · Mar 6, 2025

History

History

reactjs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024
Mar 6, 2025
Mar 28, 2024
Apr 17, 2024
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024

The Graph Query Examples | ReactJS

Demos how to query the Graph Network Arbitrum Subgraph published to The Graph Network using an API Key obtained on The Graph Studio in a ReactJS application.

Running

# Clone Repo
git clone [email protected]:graphprotocol/query-examples.git

# CD into reactjs example
cd ./examples/reactjs

# Install bun package manager, if needed
curl -fsSL https://bun.sh/install | bash

# Install deps
bun install

# Run
bun run dev

Environment Variables

# Copy the example env file into a .env.local.
cp ./.env.example ./.env.local
# replace the `{your api key here}` with your API Key
  • VITE_API_KEY - the 32-digit API Key created in The Graph Studio.
    • Note in this example, the env var is exposed to the client.

GraphQL Codegen

This repo utilizes graphql codegen. This validates our graphql and generates types to match the queries written for the app. These types can then be used to make our components type-safe to the graphql queries that will hydrate them.

# run graphql codegen to regen types from updated queries
bun run codegen.gql