Fetch data from Ethereum with SWR

How to Fetch and Update Data From Ethereum with React and SWR

Ethereum allows us to build decentralized applications (dapps). The main difference between a typical application and a dapp is that you donโ€™t need to deploy a backendโ€”at least as long as you take advantage of the other smart contracts deployed on the Ethereum mainnet.

Because of that, the frontend plays a major role. It is in charge of marshaling and unmarshaling the data from the smart contracts, handling the interactions with the wallet (hardware or software) and, as usual, managing the UX. Not only that, by design, a dapp uses JSON-RPC calls and it can open a socket connection to receive updates.

As you can see there are a few things to orchestrate but donโ€™t worry, the ecosystem has matured quite a lot in the last few months.