Skip to content

Commit c3253f7

Browse files
authored
Merge pull request #23 from alevnyacow/docs/readme-example
simplified readme example
2 parents 396ff63 + 77929f8 commit c3253f7

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,14 @@ Shared React variables provide you easy and comfortable mutable state management
1414
## 🔍 **Example**
1515

1616
```tsx
17-
const [
18-
// returns a mutable object
19-
useTimer,
20-
// use it to rewrite the whole object,
21-
// you don't need it usually
22-
useTimerRewrite
23-
] = createUseSharedVariable({ ticks: 0 });
17+
import { createUseSharedVariable } from "@alevnyacow/shared-react-variables";
18+
19+
const [useTimer] = createUseSharedVariable({ ticks: 0 });
2420

2521
const Timer = () => {
26-
// using shared react variable
2722
const timer = useTimer();
2823
useEffect(() => {
2924
setInterval(() => {
30-
// object is mutable
3125
timer.ticks++;
3226
}, 1000);
3327
}, []);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alevnyacow/shared-react-variables",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Easy and comfortable React state manager",
55
"main": "transpiled/index.js",
66
"scripts": {

tests/test-application/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@alevnyacow/shared-react-variables": "file:../../alevnyacow-shared-react-variables-2.0.1.tgz",
6+
"@alevnyacow/shared-react-variables": "file:../../alevnyacow-shared-react-variables-2.0.2.tgz",
77
"@testing-library/jest-dom": "^5.16.2",
88
"@testing-library/react": "^12.1.4",
99
"@testing-library/user-event": "^13.5.0",

0 commit comments

Comments
 (0)