skip to Main Content

I am learning solidity from last 3 months but now I am confused how to connect your contract with frontend (with react or next).
Every developer has their own way of applying it as i am, i want to with the best way
like with hardhat or truffle

2

Answers


  1. Regarding connecting to the provider, @web3-react (docs) is the most used package I believe. It supports a wide variety of connectors (Metamask, …) and you can find some good examples by googling.

    Then you need either "ethers" or "web3js" to send transactions, etc. Choose whatever you’re already familiar with.

    Login or Signup to reply.
  2. IMO, A good boilerplate to start coding on web3 is:

    Frontend :
    • ReactJs (CRA)
    • ethers.js : A great library to let you interact with smartcontract through ABI json file, Events and Transactional functions. This package is considered a MUST USE for a beginner IMO.
    • @web3-react : Written by creator of Uniswap.org, Good library to work with ethereum compatible wallets, but not necessarily for you to use. you can handle connecting ethereum compatible wallets on your own.
    SmartContract :
    • Hardhat
    • Ganache
    • RPC Urls , you may obtain testnet urls by providers like Infura and etc.

    Generally speaking of a web3 project, a backend is nothing but a RPC Node who speaks to blockchain, So using ReactJs or NextJs is up to you. But for a beginner I would recommend using ReactJS only. I suggest you look into reputable sources such as Uniswap and OpenZeppelin

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search