treble-hook
Advanced tools
Comparing version 2.0.10 to 2.0.11
@@ -11,4 +11,4 @@ import React, { Dispatch, SetStateAction } from 'react'; | ||
export declare function useSub<T>(topic: string): T; | ||
export declare function usePub<T>(topic: string): React.Dispatch<React.SetStateAction<T>>; | ||
export declare function usePub<T>(topic: string): (value: T) => void; | ||
export declare type Publish<T> = Dispatch<SetStateAction<T>>; | ||
export declare type PubSubTuple<T> = [T, Publish<T>]; |
@@ -88,3 +88,3 @@ "use strict"; | ||
} | ||
return context[1]; | ||
return (value) => { context[1](value); }; | ||
} | ||
@@ -91,0 +91,0 @@ exports.usePub = usePub; |
{ | ||
"name": "treble-hook", | ||
"version": "2.0.10", | ||
"version": "2.0.11", | ||
"description": "Get hooked on simple subscribe-and-publish in ReactJS.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -206,2 +206,4 @@ | ||
**IMPORTANT**: This hook will still cause re-renders when a new value is published even though the published value isn't used/returned. | ||
```ts | ||
@@ -208,0 +210,0 @@ usePub<T>(topic: string): (value: T) => void |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17627
263