Skip to content

Commit 7319bf3

Browse files
author
Igor Mucsicska
committed
Release 0.2.2
1 parent cdb6327 commit 7319bf3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-create-shared-state",
3-
"version": "0.2.0",
3+
"version": "0.2.2",
44
"description": "useState but with shared state across components",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",
@@ -33,7 +33,7 @@
3333
"scripts": {
3434
"test": "jest",
3535
"test:watch": "npm run test -- --watch",
36-
"typecheck": "tsc",
36+
"typecheck": "tsc --noemit",
3737
"clean": "del-cli lib",
3838
"build:declarations": "tsc --emitDeclarationOnly -p tsconfig.build.json --outDir lib",
3939
"build:compile": "babel src --out-dir lib --extensions \".ts\" --ignore \"**/*.test.ts\"",

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ export function createSharedState<ValueType>(defaultValue: ValueType) {
1616

1717
useEffect(() => {
1818
listeners.add(setValue);
19-
return () => listeners.delete(setValue);
19+
return () => {
20+
listeners.delete(setValue);
21+
};
2022
}, []);
2123

2224
return [value, setValue];

0 commit comments

Comments
 (0)