guiltygyoza / starknet-react

A collection of React providers and hooks for StarkNet

Home Page:https://auclantis.github.io/starknet-react/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.
yarn add @starknet-react/core

You also need to add @argent/get-starknet and starknet to your dependencies.

yarn add @argent/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/auclantis/starknet-react/tree/main/examples/starknet-react-next

After the installation is complete:

  • Run yarn 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.

About

A collection of React providers and hooks for StarkNet

https://auclantis.github.io/starknet-react/

License:MIT License


Languages

Language:TypeScript 87.8%Language:JavaScript 8.4%Language:CSS 3.4%Language:Shell 0.4%