Storage ClientInstallation

Installation

Install and set up the storage client for your framework

Last updated:

Installation

Install the storage client package and the required framework dependencies.

Prerequisites

The storage client requires TanStack Query (formerly React Query) for state management. You'll need to install the appropriate version for your framework:

  • React: @tanstack/react-query >= 5.90.10
  • Vue: @tanstack/vue-query >= 5.91.2
  • Solid: @tanstack/solid-query >= 5.90.13
  • Svelte: @tanstack/svelte-query >= 6.0.8

React

npm install @visulima/storage-client @tanstack/react-query react
yarn add @visulima/storage-client @tanstack/react-query react
pnpm add @visulima/storage-client @tanstack/react-query react

Setup QueryClient

Wrap your app with QueryClientProvider:

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactNode } from "react";

const queryClient = new QueryClient();

function App({ children }: { children: ReactNode }) {
    return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
}

Vue / Nuxt

npm install @visulima/storage-client @tanstack/vue-query vue
yarn add @visulima/storage-client @tanstack/vue-query vue
pnpm add @visulima/storage-client @tanstack/vue-query vue

Setup QueryClient

For Vue 3:

import { createApp } from "vue";
import { VueQueryPlugin } from "@tanstack/vue-query";

const app = createApp(App);
app.use(VueQueryPlugin);
app.mount("#app");

Nuxt 3 Setup

Create a plugin file:

// plugins/vue-query.client.ts
import { VueQueryPlugin } from "@tanstack/vue-query";

export default defineNuxtPlugin((nuxtApp) => {
    nuxtApp.vueApp.use(VueQueryPlugin);
});

Solid

npm install @visulima/storage-client @tanstack/solid-query solid-js
yarn add @visulima/storage-client @tanstack/solid-query solid-js
pnpm add @visulima/storage-client @tanstack/solid-query solid-js

Setup QueryClient

import { QueryClient, QueryClientProvider } from "@tanstack/solid-query";

const queryClient = new QueryClient();

function App() {
    return <QueryClientProvider client={queryClient}>{/* Your app */}</QueryClientProvider>;
}

Svelte

npm install @visulima/storage-client @tanstack/svelte-query svelte
yarn add @visulima/storage-client @tanstack/svelte-query svelte
pnpm add @visulima/storage-client @tanstack/svelte-query svelte

Setup QueryClient

<script lang="ts">
  import { QueryClient, QueryClientProvider } from "@tanstack/svelte-query";

  const queryClient = new QueryClient();
</script>

<QueryClientProvider client={queryClient}>
  <!-- Your app -->
</QueryClientProvider>

Import Paths

Import hooks/composables from framework-specific paths:

// React
import { useUpload } from "@visulima/storage-client/react";

// Vue
import { useUpload } from "@visulima/storage-client/vue";

// Solid
import { createUpload } from "@visulima/storage-client/solid";

// Svelte
import { createUpload } from "@visulima/storage-client/svelte";

TypeScript Support

The package includes full TypeScript definitions. No additional @types packages are required.

Next Steps

  • React Guide - Learn how to use the storage client with React
  • Vue / Nuxt Guide - Learn how to use the storage client with Vue and Nuxt
  • Solid Guide - Learn how to use the storage client with Solid
  • Svelte Guide - Learn how to use the storage client with Svelte
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues