New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@blitzjs/core

Package Overview
Dependencies
Maintainers
4
Versions
327
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blitzjs/core

Blitz.js core functionality

0.40.1-danger.80fd9692.20
Source
npm
Version published
Weekly downloads
372
-25%
Maintainers
4
Weekly downloads
 
Created
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

Package last updated on 06 Oct 2021

Did you know?

Socket

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