react-use-sub
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -41,4 +41,3 @@ 'use strict'; | ||
const p = D.data[key]; | ||
const n = next[key]; | ||
result[key] = n !== undefined ? n : p; | ||
result[key] = key in next ? next[key] : p; | ||
}); | ||
@@ -45,0 +44,0 @@ D.data = result; |
@@ -37,4 +37,3 @@ import { useRef, useCallback, useEffect, useState } from 'react'; | ||
const p = D.data[key]; | ||
const n = next[key]; | ||
result[key] = n !== undefined ? n : p; | ||
result[key] = key in next ? next[key] : p; | ||
}); | ||
@@ -41,0 +40,0 @@ D.data = result; |
{ | ||
"name": "react-use-sub", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Subscription based lightweight React store", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -56,11 +56,6 @@ [![GitHub license][license-image]][license-url] | ||
### Optional types | ||
Since TypeScript [can not distinguish](https://github.com/microsoft/TypeScript/issues/13195) | ||
between missing fields and undefined values, you have to use `null` | ||
on top-level. Please don't use optional fields on top-level. Updates | ||
with `undefined` on top-level will be simply ignored. | ||
Since version [2.0.0](https://github.com/fdc-viktor-luft/react-use-sub/blob/master/CHANGELOG.md#200---2021-03-21) you | ||
can simply specify the optional type you want. | ||
```ts | ||
// BAD | ||
type State = { lastVisit?: Date }; | ||
// GOOD | ||
type State = { lastVisit: null | Date }; | ||
@@ -67,0 +62,0 @@ ``` |
Sorry, the diff of this file is not supported yet
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
24495
12
287