odd-preact
ODD SDK Preact hooks and context provider.
Install
pnpm install @oddjs/preact
Usage
import { OddContextProvider } from '@oddjs/preact'
const config = {
namespace: {
creator: document.location.host,
name: 'Passkey auth',
},
}
export function App() {
return (
<>
<OddContextProvider
config={config}
componentsFactory={OddPasskey.createComponents}
>
<main className="App">
<Home path="/" />
</main>
</OddContextProvider>
</>
)
}
import { useOddContext } from '@oddjs/preact'
export default function Home(props) {
const { session, isLoading, login, logout, register } = useOddContext()
}
import { useOdd } from '@oddjs/preact/router'
export default function Home(props) {
const { session, isLoading, login, logout, register } = useOdd({
redirectTo: '/login',
})
}
Docs
Check https://oddsdk.github.io/passkeys/modules/_oddjs_preact.html