https://github.com/usebarekey/react
React bindings for Barekey
https://github.com/usebarekey/react
Last synced: 10 days ago
JSON representation
React bindings for Barekey
- Host: GitHub
- URL: https://github.com/usebarekey/react
- Owner: usebarekey
- License: bsd-3-clause
- Created: 2026-03-13T18:34:32.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2026-03-14T01:37:46.000Z (4 months ago)
- Last Synced: 2026-03-14T07:01:35.300Z (4 months ago)
- Language: TypeScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# @barekey/react
React bindings for Barekey with Suspense-friendly `useBarekey()` reads and a dev-only browser leak guard for private variables.
```tsx
import { PublicBarekeyClient } from "@barekey/sdk/public";
import { BarekeyProvider, useBarekey } from "@barekey/react";
import barekeyConfig from "../barekey.json" with { type: "json" };
const barekeyClient = new PublicBarekeyClient({
json: barekeyConfig,
});
function App() {
const env = useBarekey();
return
{env.get("PUBLIC_THEME")};
}
export function Root() {
return (
);
}
```
You can also pass a client directly when you want to read Barekey values before any provider exists:
```tsx
import { PublicBarekeyClient } from "@barekey/sdk/public";
import { useBarekey } from "@barekey/react";
import barekeyConfig from "../barekey.json" with { type: "json" };
function Bootstrap() {
const env = useBarekey(new PublicBarekeyClient({ json: barekeyConfig }));
return
{env.get("PUBLIC_THEME")};
}
```