@oddjs/preact
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

odd-preact NPM Version License odd-passkeys

ODD SDK Preact hooks and context provider.

Install

pnpm install @oddjs/preact

Usage

// app.jsx
import { OddContextProvider } from '@oddjs/preact'
/** @type {import('@oddjs/odd').Configuration} */
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>
    </>
  )
}

// home.jsx
import { useOddContext } from '@oddjs/preact'

export default function Home(props) {
  const { session, isLoading, login, logout, register } = useOddContext()
}

// home.jsx with preact-router
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

Readme

Keywords

Package Sidebar

Install

npm i @oddjs/preact

Weekly Downloads

1

Version

0.3.0

License

apache-2.0

Unpacked Size

15.2 kB

Total Files

11

Last publish

Collaborators

  • fission-bot
  • hugomrdias
  • philipp-fission
  • andrewvivash
  • bgins-fission
  • borismann
  • icidasset
  • walkah