Function useStorageUpload

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

    Type Parameters

    • T extends UploadOptions = IpfsUploadBatchOptions

    Parameters

    • Optional uploadOptions: T

    Returns UseMutationResult

    Function used to upload files or JSON to decentralized storage systems

    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>
    )
    }

    See

    Documentation

Generated using TypeDoc