mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 20:37:21 +00:00
restructured elements slightly for better customization, updated readme and docs
This commit is contained in:
@@ -3,7 +3,7 @@ title: 'SDK (React)'
|
||||
description: 'Use the bknd SDK for React'
|
||||
---
|
||||
|
||||
bknd exports 4 useful hooks to work with your backend:
|
||||
There are 4 useful hooks to work with your backend:
|
||||
1. simple hooks which are solely based on the [API](/usage/sdk):
|
||||
- [`useApi`](#useapi)
|
||||
- [`useEntity`](#useentity)
|
||||
@@ -11,6 +11,22 @@ bknd exports 4 useful hooks to work with your backend:
|
||||
- [`useApiQuery`](#useapiquery)
|
||||
- [`useEntityQuery`](#useentityquery)
|
||||
|
||||
|
||||
## Setup
|
||||
In order to use them, make sure you wrap your `<App />` inside `<ClientProvider />`, so that these hooks point to your bknd instance:
|
||||
|
||||
```tsx
|
||||
import { ClientProvider } from "bknd/client";
|
||||
|
||||
export default function App() {
|
||||
return <ClientProvider>
|
||||
{/* your app */}
|
||||
</ClientProvider>
|
||||
}
|
||||
```
|
||||
|
||||
For all other examples below, we'll assume that your app is wrapped inside the `ClientProvider`.
|
||||
|
||||
## `useApi()`
|
||||
To use the simple hook that returns the Api, you can use:
|
||||
```tsx
|
||||
|
||||
Reference in New Issue
Block a user