0.3.0 • Published 12 months ago

@oddjs/preact v0.3.0

Weekly downloads
-
License
apache-2.0
Repository
github
Last release
12 months ago

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

0.3.0

12 months ago

0.2.2

12 months ago

0.2.1

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago

0.0.1

12 months ago