use-synchronized-state 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
- Removes the cascading update problem
|
|
6
6
|
- Same API as useState
|
|
7
7
|
- No extra dependencies
|
|
8
|
-
- Written in
|
|
8
|
+
- Written in React with Typescript
|
|
9
9
|
- Typescript support
|
|
10
10
|
- Small bundle size
|
|
11
11
|
|
|
@@ -110,7 +110,7 @@ What react docs tell us to do in this case can be found here
|
|
|
110
110
|
https://react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes.
|
|
111
111
|
I have changed the above example to match it. It still rerenders the ChildComponent twice, which still causes a
|
|
112
112
|
performance penalty, is hard to reason about and works only for states defined in the same component
|
|
113
|
-
(if
|
|
113
|
+
(if syncState was a prop, it wouldn't work).
|
|
114
114
|
|
|
115
115
|
```typescript
|
|
116
116
|
function ChildComponent({ parentState }: { parentState: number }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-synchronized-state",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "A React hook that creates a synchronized state with a reactive value in react (fixing the Cascading updates issue)",
|
|
5
5
|
"homepage": "https://github.com/rhorge/use-safe-context#readme",
|
|
6
6
|
"bugs": {
|