Web3.js is another option (though ethers.js is generally preferred).
Install:
npm install web3
Example:
import Web3 from "web3";
import MyContractABI from "./MyContract.json";
const web3 = new Web3(window.ethereum);
const contract = new web3.eth.Contract(MyContractABI.abi, "0xYourContractAddress");
async function interact() {
const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
// Read data
const value = await contract.methods.myPublicVariable().call();
console.log("Value:", value);
// Write transaction
await contract.methods.setMyPublicVariable(42).send({ from: accounts[0] });
}