create-global-hook
Advanced tools
Comparing version 0.0.1 to 0.1.0
{ | ||
"name": "create-global-hook", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Takes an aribtrary React hook and makes it globally stateful", | ||
"main": "index.js", | ||
"main": "build/create-global-hook.js", | ||
"types": "build/create-global-hook.d.ts", | ||
"repository": "https://github.com/garbles/create-global-hook", | ||
@@ -7,0 +8,0 @@ "author": "Gabe Scholz <hi@gabe.pizza>", |
@@ -10,3 +10,5 @@ Takes an aribtrary React hook and makes it globally stateful. | ||
const [hook, Provider] = createHook((value: number) => React.useState(value)); | ||
const [hook, Provider] = createGlobalHook((value: number) => | ||
React.useState(value) | ||
); | ||
@@ -19,5 +21,12 @@ const App = () => { | ||
const OtherApp = () => { | ||
const [state, setState] = hook(); | ||
// same state here | ||
}; | ||
ReactDOM.render( | ||
<Provider value={0}> | ||
<App /> | ||
<OtherApp /> | ||
</Provider>, | ||
@@ -24,0 +33,0 @@ document.getElementById("root") |
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
3125
34