Socket
Socket
Sign inDemoInstall

@blitzjs/core

Package Overview
Dependencies
508
Maintainers
4
Versions
327
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @blitzjs/core

Blitz.js core functionality


Version published
Maintainers
4
Install size
64.6 MB
Created

Readme

Source

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
}

FAQs

Last updated on 13 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc