Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/use-sync-external-store

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/use-sync-external-store

TypeScript definitions for use-sync-external-store

  • 0.0.6
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/use-sync-external-store?

The @types/use-sync-external-store package provides TypeScript type definitions for the useSyncExternalStore hook, which is a part of React's experimental API for subscribing to external stores. This hook allows you to synchronize your component's state with an external store without causing unnecessary re-renders, making it particularly useful for integrating non-React state management libraries with React components.

What are @types/use-sync-external-store's main functionalities?

Type-safe integration with external stores

This code demonstrates how to create a custom hook that uses useSyncExternalStore to subscribe to an external store. The hook takes a store object with subscribe and getState methods, subscribes to the store, and returns the current state. TypeScript types ensure the integration is type-safe.

import { useSyncExternalStore } from 'use-sync-external-store';

function useCustomStore(store) {
  const state = useSyncExternalStore(
    store.subscribe,
    store.getState
  );
  return state;
}

Other packages similar to @types/use-sync-external-store

FAQs

Package last updated on 07 Nov 2023

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc