thirdweb React SDK
A collection of React hooks and UI components for your web3 apps, on any blockchain.
- npm
- yarn
- pnpm
npm i @thirdweb-dev/react @thirdweb-dev/sdk ethers
yarn add @thirdweb-dev/react @thirdweb-dev/sdk ethers
pnpm i @thirdweb-dev/react @thirdweb-dev/sdk ethers
Starter Kits • Templates • GitHub Repository
Get Started
Wrap your application with the ThirdwebProvider
component like so:
App.jsx
import { ThirdwebProvider } from "@thirdweb-dev/react";
const App = () => {
return (
<ThirdwebProvider>
<YourApp />
</ThirdwebProvider>
);
};
Below are examples of where to set this up in your application.
Create React App • Next.js • Vite
Using the SDK
That’s it! You're now ready to use all the hooks and components in the SDK.
The first thing you likely want to do is connect to a smart contract:
index.jsx
import { useContract } from "@thirdweb-dev/react";
const Home = () => {
const { contract, isLoading, error } = useContract(
"0x6604bd9D7770035f26B4ACeab2C746fdCE16473",
);
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return <h1>Contract found!</h1>;
};