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

react-singleton-hook

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-singleton-hook - npm Package Compare versions

Comparing version 2.0.27 to 2.0.28

2

package.json
{
"name": "react-singleton-hook",
"version": "2.0.27",
"version": "2.0.28",
"description": "Share custom hook state across all components",

@@ -5,0 +5,0 @@ "keywords": [

@@ -27,3 +27,16 @@ React Singleton Hook

## What is a singleton hook
- Singleton hooks very similar to React Context in terms of functionality. Each singleton hook has s body,
you might think of it as of Context Provider body. Hook has a return value, it's similar to the value provided by context.
Using a singleton hook from a component is like consuming a context.
- Singleton hooks are lazy. the body is not executed until the hook is called by some component or other hook.
Once loaded, the hook body remains loaded forever.
If you want to eager-load some Singleton hooks, use them at the top-level component of your App.
- Singleton hooks do not require a provider or a special App structure.
Under the hood, it uses useState/useRef/useEffect and some less-known react features for performance and portability.
- It's possible to mix into single app Singleton hooks, React-Redux hooks api, React Context hooks and any custom hook.
## Examples

@@ -30,0 +43,0 @@ #### convert any custom hook into singleton hook

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