
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@fuels/react
Advanced tools
The Fuel Wallet React Hooks provide a set of hooks to seamless integrate the Fuel Wallet browser extension with any React JS or Next JS project.
npm install fuels @fuels/react
Note that the fuels package is also required as a dependency for better integration with other applications built using the Fuels TS SDK.
Adding the providers on the upper level of the application that will use the hooks.
import { FuelProvider } from '@fuels/react';
import { App } from './App';
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<FuelProvider>
<App />
</FuelProvider>
</React.StrictMode>,
);
import { useState } from 'react';
import {
useConnect,
useConnectors,
useDisconnect,
useIsConnected,
} from '@fuels/react';
export default function App() {
const [connector, setConnector] = useState('');
const { connectors } = useConnectors();
const { connect } = useConnect();
const { disconnect } = useDisconnect();
const { isConnected } = useIsConnected();
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
gap: 10,
padding: 10,
maxWidth: 300,
}}
>
<select
onChange={(e) => {
console.log(e.target.value);
setConnector(e.target.value);
}}
>
<option value="">Select a connector</option>
{connectors.map((c) => (
<option key={c.name} value={c.name}>
{c.name}
</option>
))}
</select>
<button disabled={!connector} onClick={() => connect(connector)}>
Connect to {connector}
</button>
<button disabled={!connector} onClick={() => disconnect()}>
Disconnect from {connector}
</button>
<p>{isConnected ? 'Connected' : ''}</p>
</div>
);
}
Please visit our docs to get started using the Fuel Wallet React Hooks.
Additionally, you can check up the Fuel Wallet React Hooks reference for more details.
This repo is licensed under the Apache-2.0 license. See LICENSE for more information.
FAQs
Interact with the Fuel Wallet Extension in React.
The npm package @fuels/react receives a total of 1,278 weekly downloads. As such, @fuels/react popularity was classified as popular.
We found that @fuels/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.