@stackso/nextjs
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@stackso/nextjs

@stackso/nextjs provides a nextjs + react wrapper for the Stack API.

Install packages

pnpm i @stackso/core @stackso/nextjs

Usage

Set environment variables:

NEXT_PUBLIC_STACK_API_KEY=<stack api key>
NEXT_PUBLIC_STACK_API_URL=<stack url>

To setup the stack provider:

import { StackProvider } from '@stackso/nextjs'


function App() {
  return (
    <StackProvider>
      <YourRoutes />
    </StackProvider>
  )
}

Hooks usage:

import { useSignup } from '@stackso/nextjs'

function App() {
  const { signup, isLoading, isSuccess } = useSignup();
  const { email, setEmail } = useState<string>("");
  const { password, setPassword } = useState<string>("");

  const handleSignup = async (event) => {
    // Handle event

    await signup({
      email,
      password
    });

    // Handle success
  };

  return (
    { /* other components here */ }
    <button
      onClick={handleSignup}
    >
      Signup
    </button>
  );
}

/@stackso/nextjs/

    Package Sidebar

    Install

    npm i @stackso/nextjs

    Weekly Downloads

    0

    Version

    0.0.3

    License

    ISC

    Unpacked Size

    67.6 kB

    Total Files

    35

    Last publish

    Collaborators

    • marystackso
    • graemecode
    • cece_stack
    • volt99