Quick start
(in 5 minutes or less 😉)
- Create a React app
- Connect your app to your smart contracts.
- Install Eth-hooks in your React app root folder by entering the following in your terminal
yarn add eth-hooks
- Setup context in your React app
index.tsx
file
src/index.tsx
<ContractsAppContext>
<EthersAppContext>
<App />
</EthersAppContext>
</ContractsAppContext>
- If you're using providers, here's an example of how they sould look in your
App.tsx
file
src/App.tsx
export default function App() {
return (
<ContractsAppContext>
<EthersAppContext>
<ThemeSwitcherProvider>
<MainPage />
</ThemeSwitcherProvider>
</EthersAppContext>
</ContractsAppContext>
);
}
Now you can use any Eth-hook you need anywhere in your application.
Try Scaffold-eth (Solidity, Hardhat, Ethers, and React.
Check out Scaffold-eth-typescript.