react-svelte-stores
Advanced tools
Comparing version 0.1.2 to 0.1.4
@@ -6,3 +6,3 @@ import { IStore } from "./types"; | ||
/** Selector to prevent unnecesary re-renders. Used when store value is not a primitive. Use memoized selectors if your selector involves expensive computations */ | ||
export declare const useSelectedStoreState: <T, R>(store: IStore<T>, selector: Selector<T, R>) => R; | ||
export declare const useSelectedStoreState: <T, R>(store: IStore<T>, selector: Selector<T, R>, selectorDeps?: import("react").DependencyList) => R; | ||
export {}; |
@@ -15,3 +15,3 @@ "use strict"; | ||
/** Selector to prevent unnecesary re-renders. Used when store value is not a primitive. Use memoized selectors if your selector involves expensive computations */ | ||
exports.useSelectedStoreState = (store, selector) => { | ||
exports.useSelectedStoreState = (store, selector, selectorDeps) => { | ||
const [state, setState] = react_1.useState(selector(stores_1.get(store))); | ||
@@ -22,3 +22,6 @@ react_1.useLayoutEffect(() => { | ||
}, []); | ||
react_1.useEffect(() => { | ||
setState(selector(stores_1.get(store))); | ||
}, selectorDeps ? selectorDeps : []); | ||
return state; | ||
}; |
{ | ||
"name": "react-svelte-stores", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
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
34094
664