Skip to content

Documentation for using hasura-storage outside of nhost #155

Answered by commandodev
commandodev asked this question in Q&A
Discussion options

You must be logged in to vote

What I was after was more about how to use the newly set up service from the front end:

Here's what I came up with:

import React, { createContext, useContext, useState, useEffect } from 'react';
import { HasuraStorageClient } from '@nhost/hasura-storage-js';
import { useAuth } from '@clerk/clerk-react';
import { env } from '~/env.mjs';

interface HasuraStorageContextProps {
  client: HasuraStorageClient | null;
}

const HasuraStorageContext = createContext<HasuraStorageContextProps>({
  client: null,
});

export const HasuraStorageProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
  const { getToken } = useAuth();

  const [hasuraStorageClient, setHasuraStorageClient] = 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by dbarrosop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #154 on April 27, 2023 07:36.