DOCS

useStorageUpload

Hook used to upload any files or JSON data to decentralized storage systems like IPFS, using the storageInterface configured on the ThirdwebProvider

Example

import { useStorageUpload } from "@thirdweb-dev/react";

export default function Component() {
  const { mutateAsync: upload, isLoading } = useStorageUpload();

  async function uploadData() {
    const filesToUpload = [...];
    const uris = await upload({ data: files });
    console.log(uris);
  }

  return (
    <button onClick={uploadData}>
      Upload
    </button>
  )
}

Parameters

Returns

Function used to upload files or JSON to decentralized storage systems