File tree Expand file tree Collapse file tree 4 files changed +8
-11
lines changed
Expand file tree Collapse file tree 4 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -15,19 +15,19 @@ Shared React variables provide you easy and comfortable mutable state management
1515
1616``` tsx
1717const [
18- // returns a mutable state
18+ // returns a mutable object
1919 useTimer,
20- // use it to rewrite the whole variable ,
21- // normally you don't need it
20+ // use it to rewrite the whole object ,
21+ // you don't need it usually
2222 useTimerRewrite
2323] = createUseSharedVariable ({ ticks: 0 });
2424
2525const Timer = () => {
26- // using timer state
26+ // using shared react variable
2727 const timer = useTimer ();
2828 useEffect (() => {
2929 setInterval (() => {
30- // state is mutable
30+ // object is mutable
3131 timer .ticks ++ ;
3232 }, 1000 );
3333 }, []);
@@ -36,7 +36,7 @@ const Timer = () => {
3636};
3737
3838const AnotherTimerWithSameState = () => {
39- // using same timer state in another component
39+ // using the same variable in another component
4040 const timer = useTimer ();
4141
4242 return <div >{ timer .ticks } </div >
Original file line number Diff line number Diff line change 11{
22 "name" : " @alevnyacow/shared-react-variables" ,
3- "version" : " 2.0.0 " ,
3+ "version" : " 2.0.1 " ,
44 "description" : " Easy and comfortable React state manager" ,
55 "main" : " transpiled/index.js" ,
66 "scripts" : {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 33 "version" : " 0.1.0" ,
44 "private" : true ,
55 "dependencies" : {
6- "@alevnyacow/shared-react-variables" : " file:../../alevnyacow-shared-react-variables-2.0.0 .tgz" ,
6+ "@alevnyacow/shared-react-variables" : " file:../../alevnyacow-shared-react-variables-2.0.1 .tgz" ,
77 "@testing-library/jest-dom" : " ^5.16.2" ,
88 "@testing-library/react" : " ^12.1.4" ,
99 "@testing-library/user-event" : " ^13.5.0" ,
You can’t perform that action at this time.
0 commit comments