Socket
Book a DemoInstallSign in
Socket

@codebayu/use-hydration-zustand

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codebayu/use-hydration-zustand

React hook for handle the persist state of zustand

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

@codebayu/use-hydration-zustand

A React Custom Hook for Zustand state management library to simplify hydration handling.

Installation

# npm
npm install @codebayu/use-hydration-zustand

# yarn
yarn add @codebayu/use-hydration-zustand

Usage

import { useHydrationZustand } from '@codebayu/use-hydration-zustand';
import create from 'zustand';

// Your Zustand store
const useStore = create((set) => ({
  // Your store definition here
}));

function MyComponent() {
  // Use the useHydrationZustand hook
  const isHydrated = useHydrationZustand(useStore);

  return (
    <div>
      {isHydrated ? (
        items.map((item) => <Card {...item} key={item.id} />)
      ) : (
        <Loading />
      )}
    </div>
  );
}

export default MyComponent;

API

useHydrationZustand(store) A hook for Zustand that simplifies hydration handling.

Parameters

  • store (UseBoundStore<any>): The Zustand store.

Returns

  • boolean: true if the store has finished hydration, false otherwise.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

hydrate

FAQs

Package last updated on 23 Jan 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.