Skip to content

Giwook-Han/starknet-react

 
 

Repository files navigation

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/apibara/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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 89.1%
  • JavaScript 7.5%
  • CSS 3.0%
  • Shell 0.4%