File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
packages/thirdweb/src/react/web/ui/prebuilt/NFT Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1- import { createContext , useContext } from "react" ;
1+ import { Suspense , createContext , useContext } from "react" ;
22import type { ThirdwebContract } from "../../../../../contract/contract.js" ;
33
44/**
@@ -14,6 +14,10 @@ export type NFTProviderProps = {
1414 * The tokenId whose info you want to display
1515 */
1616 tokenId : bigint ;
17+ /**
18+ * Fallback content to display while the NFT data is being fetched
19+ */
20+ fallback ?: React . ReactNode ;
1721} ;
1822
1923/**
@@ -57,19 +61,17 @@ export function useNFTContext() {
5761 * client: yourThirdwebClient,
5862 * });
5963 *
60- * <NFT.Provider contract={contract} tokenId={0n}>
61- * <Suspense fallback={"Loading media..."}>
62- * <NFT.Media />
63- * <NFT.Description />
64- * </Suspense>
64+ * <NFT.Provider contract={contract} tokenId={0n} fallback={"Loading media..."}>
65+ * <NFT.Media />
66+ * <NFT.Description />
6567 * </NFT>
6668 * ```
6769 * @nft
6870 */
6971export function Provider ( props : React . PropsWithChildren < NFTProviderProps > ) {
7072 return (
7173 < NFTProviderContext . Provider value = { props } >
72- { props . children }
74+ < Suspense fallback = { props . fallback ?? null } > { props . children } </ Suspense >
7375 </ NFTProviderContext . Provider >
7476 ) ;
7577}
You can’t perform that action at this time.
0 commit comments