Skip to content

Latest commit

 

History

History
86 lines (60 loc) · 2.35 KB

README.md

File metadata and controls

86 lines (60 loc) · 2.35 KB

StarkNet React

@starknet-react/core Release Status MIT LICENSE

StarkNet React is a collection of React hooks for StarkNet. It is inspired by wagmi, powered by starknet.js.

Documentation

Documentation, including a small demo, is available online.

Getting Started

  1. 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
  1. Wrap your app with StarknetProvider
import { StarknetProvider } from '@starknet-react/core'

function App() {
  return (
    <StarknetProvider>
      <YourApp />
    </StarknetProvider>
  )
}
  1. Access the hooks from your components.
import { useStarknet } from '@starknet-react/core'

function YourComponent() {
  const { account } = useStarknet()

  return <div>gm {account}</div>
}

Getting Started with Next.js

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.

Projects using StarkNet React

Using StarkNet React? Add your project to this list by opening a Pull Request.

License

This library is licensed under the MIT license.