@gately/react
v2.3.6
Published
React SDK for Gately - built on @gately/gately-js core
Maintainers
Readme
@gately/react
Official React SDK for Gately — authentication, payments, and user management.
Installation
npm install @gately/reactQuick Start
import { GatelyProvider, useGately } from '@gately/react';
function App() {
return (
<GatelyProvider projectId="your-project-id">
<Dashboard />
</GatelyProvider>
);
}
function Dashboard() {
const { user, isAuthenticated, logout } = useGately();
if (!isAuthenticated) return <p>Not logged in</p>;
return (
<div>
<p>Welcome, {user?.email}</p>
<button onClick={logout}>Logout</button>
</div>
);
}Features
- Hooks-based API (useGately, useAuth, useUser)
- Context-based state management
- Type-safe with full TypeScript support
- Automatic session management
- OAuth and social login support
- Protected route components
Available Hooks
useGately()— Access authentication state and methodsuseAuth()— Authentication-specific hooksuseUser()— User profile and datauseProtected()— Route protection
Documentation
For complete documentation and examples, visit:
https://usegately.com/docs/sdk/react
Built On
This SDK is built on @gately/gately-js, the core Gately SDK.
