@blitzjs/core
TypeScript icon, indicating that this package has built-in type declarations

0.41.1 • Public • Published

core

This package contains the application-facing offerings of BlitzJS.

Some of the fullstack features that are available include:

  • Authentication Utilities
  • React Hooks
  • Session Management
  • Wrappers for the data-layer communications (RPC)

Usage

Fetch data from a query

import {useQuery} from "blitz"
import getUsers from "app/users/queries/getUsers"

const Users = () => {
  const [users] = useQuery(getUsers, {})

  return <pre style={{maxWidth: "30rem"}}>{JSON.stringify(users, null, 2)}</pre>
}

Session Context

import {Ctx} from "blitz"

export default async function trackView(_ = null, {session}: Ctx) {
  const currentViews = session.publicData.views || 0
  await session.setPublicData({views: currentViews + 1})
  await session.setPrivateData({views: currentViews + 1})

  return
}

Readme

Keywords

none

Package Sidebar

Install

npm i @blitzjs/core

Weekly Downloads

200

Version

0.41.1

License

MIT

Unpacked Size

100 kB

Total Files

56

Last publish

Collaborators

  • siddhsuresh
  • dillonraphael
  • mabadir
  • flybayer
  • skn0tt