Getting Started
To get started, install the required dependencies into your React project.
- Existing Projects
- New Projects
npm install @thirdweb-dev/react @thirdweb-dev/sdk @ethers^5
npx thirdweb create app
Wrap your application in the ThirdwebProvider
component to start using the SDK.
import { ThirdwebProvider } from "@thirdweb-dev/react";
const App = () => {
return (
<ThirdwebProvider activeChain="ethereum">
<YourApp />
</ThirdwebProvider>
);
};
Examples of where to set this up: Create React App • Next.js • Vite
With the provider set up, all of the SDK’s hooks and components work out of the box!
Now you can connect to the user’s wallet and start calling functions on your smart contracts like so:
import { Web3Button } from "@thirdweb-dev/react";
const Home = () => {
return (
<Web3Button
contractAddress={"{{contract_address}}"}
action={async (contract) => contract.call("myFunctionName")}
>
Call myFunctionName from the connected wallet
</Web3Button>
);
};