Note: The resource above offers an in-depth explanation on the information summarized below.
Welcome to this tutorial on building a frontend for your smart contracts using react-celo. This workshop is facilitated by Aaron from seaLabs, who is the manager of the react-celo repo. The goal of this workshop is to gain an understanding of how this package connects wallets to your Dapp.
The basis of the setup involves using the Celo provider which is imported from the package. All components should be wrapped with this provider. The required prop for this is the Dapp prop. Once you’ve set up the provider, you can create a connect button to connect a wallet to the Dapp. The useCelo hook, which is given by the provider, is used to realize contracts.
Most of this tutorial is comprised of detailed code examples that are explained line by line. Examples cover creating a callback function, calling a long running transaction, performing a transfer, and storing data in a contract.
Once you’re connected, you can have users interact with your smart contracts. Code examples and detailed explanations are provided for this as well. For example, you can create functions to call a long running transaction and perform actions such as transferring cusd (a stablecoin on the Celo network) and storing text in a contract.
React-Celo offers several customization features. For instance, you can specify which chains to support, what the default one is, and more. You can also customize the connect modal and action modal to fit your Dapp’s use case. Examples of how to do this are given in the tutorial.
Celo Composer is a template built to make your life as a developer easier. It contains a couple of packages that give you an idea of how react-celo works in a website. With Celo Composer, you can read information for the account, store data, and interact with an ERC20 token.
This tutorial should provide a strong foundation for building a frontend for your smart contracts using react-celo. Remember, the goal is to understand how this package connects wallets to your Dapp. Aaron’s detailed explanations, code examples, and tips should prove useful as you explore this package. Introductio