StarkNet React is a collection of React hooks for StarkNet. It is inspired by wagmi, powered by starknet.js.
Documentation, including a small demo, is available online.
- Add
@starknet-react/core
to your dependencies.
pnpm add @starknet-react/core
You also need to add get-starknet
and starknet
to your dependencies.
pnpm add get-starknet starknet
- Wrap your app with
StarknetProvider
import { StarknetProvider } from '@starknet-react/core'
function App() {
return (
<StarknetProvider>
<YourApp />
</StarknetProvider>
)
}
- Access the hooks from your components.
import { useStarknet } from '@starknet-react/core'
function YourComponent() {
const { account } = useStarknet()
return <div>gm {account}</div>
}
If you plan to use StarkNet React with Next.js, you can use the provided template:
npx create-next-app@latest --example https://github.com/apibara/starknet-react/tree/main/examples/starknet-react-next
After the installation is complete:
- Run
pnpm run dev
to start the development server. - Visit
http://localhost:3000
to view your StarkNet-powered application.
- Bitmap Box - on-chain 2D block-building game.
- Eykar - on-chain game of conquest and strategy.
- Starknet Name Service - Starknet-native name registry service.
Using StarkNet React? Add your project to this list by opening a Pull Request.
This library is licensed under the MIT license.