![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@3rdweb/hooks
Advanced tools
Welcome to the Thirdweb ReactnHooks Library. This package provides you with extensible react hooks to handle the web3 side of your app.
We simplify the process of integrating web3 into your apps while making sure that you still have all the control you would using other lower level web3 frontend libraries.
Our main features are:
To get started with using our hooks, you just need to setup the ThirdwebWeb3Provider
that provides all the context consumed by your app.
Setting up this context is as easy as wrapping your app with the following setup:
import { ThirdwebWeb3Provider } from "@3rdweb/hooks";
const App = ({ children }) => {
// Put the ethereum chain ids of the chains you want to support
const supportedChainIds = [1, 4, 137];
/**
* Include the connectors you want to support
* injected - MetaMask
* magic - Magic Link
* walletconnect - Wallet Connect
* walletlink - Coinbase Wallet
*/
const connectors = {
injected: {},
magic: {
apiKey: "pk_...", // Your magic api key
chainId: 1, // The chain ID you want to allow on magic
},
walletconnect: {},
walletlink: {
appName: "thirdweb - demo",
url: "https://thirdweb.com",
darkMode: false,
},
};
/**
* Make sure that your app is wrapped with these contexts.
* If you're using Next JS, you'll have to replace children with the Component setup
*/
return (
<ThirdwebWeb3Provider
supportedChainIds={supportedChainIds}
connectors={connectors}
>
{children}
</ThirdwebWeb3Provider>
);
};
You can build your own connect wallet button with our useWeb3
and useSwitchNetwork
hooks.
You can see how these hooks are used in the following example.
import React, { useState } from "react"
import { useWeb3, useSwitchNetwork } from "@3rdweb/hooks"
const supportedChainIds = [1, 4, 137];
const CustomConnect = () => {
const { address, chainId, connectWallet, disconnectWallet, getNetworkMetadata } = useWeb3();
const { switchNetwork } = useSwitchNetwork();
const [email, setEmail] = useState("");
return (
<>
Address: {address}
<br />
Chain ID: {chainId}
<br />
{address && (
<button onClick={disconnectWallet}>
Disconnect
</button>
)}
<p>Switch Network</p>
{supportChainIds.map((cId) => (
<button onClick={() => switchNetwork(cId)}>
{getNetworkMetadata(cId).chainName}
</button>
))}
<input value={email} onChange={e => setEmail(e.target.value)} />
<button
onClick={() => connectWallet("magic", {
email
})}
>
Connect Magic Link
</button>
<button onClick={() => connectWallet("injected")}>
Connect MetaMask
</button>
<button onClick={() => connectWallet("walletconnect")}>
Connect Wallet Connect
</button>
<button onClick={() => connectWallet("walletlink")}>
Connect Coinbase Wallet
</button>
<>
)
}
For a fully functional setup using our custom hooks, you can checkout our NextJS example hooks page.
After you setup wallet connection with the above method, accessing your connected web3 provider and its related info is as easy as the following:
import React from "react";
import { useWeb3 } from "@3rdweb/react";
const Component = () => {
// You can do whatever you want with this data
const { address, chainId, provider } = useWeb3();
return (
<div>
Address: {address}
<br />
Chain ID: {chainId}
</div>
);
};
FAQs
Unknown package
The npm package @3rdweb/hooks receives a total of 243 weekly downloads. As such, @3rdweb/hooks popularity was classified as not popular.
We found that @3rdweb/hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.