Question: I need help with a react Graphql project to fetch data from this endpoint: https://squid.subsquid.io/subsocial/graphql index.js import Head from 'next/head' import { ApolloClient, InMemoryCache, gql

I need help with a react Graphql project to fetch data from this endpoint: https://squid.subsquid.io/subsocial/graphql

index.js

import Head from 'next/head' import { ApolloClient, InMemoryCache, gql } from '@apollo/client'; import styles from '../styles/Home.module.css'

export default function Home({ launches }) { return (

Create Next App

SpaceX Launches

Latest launches from SpaceX

{reactions.map(post => { return (

{ post.title }

Followers Count { new Date(post.reactionsCount) }

); })}

Powered by{' '}

) }

export async function getStaticProps() { const client = new ApolloClient({ uri: 'https://squid.subsquid.io/subsocial/graphql', cache: new InMemoryCache() });

const { data } = await client.query({ query: gql` query myQuery { post (orderBy: reactionsCount_DESC, limit: 3, where: {createdAtTime_gt: "2023-01-01T00:00:00.000000Z"}) { content title reactionsCount sharedPost { id } createdAtTime space { id name summary } } } ` });

return { props: { reactions: data.post } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!