Comments (8)
@ha-ku Yes, it is. However, I'm concerned the shim will double the bundle size of the hook which isn't a no-go but it is something worth considering.
Indeed. Maybe the way to find the answer is simply making a test version with the shim. Then we'll find out how much the bundle size get influenced. Of cource, this should be something after the implementation with useSyncExternalStore
getting finished.
from use-local-storage-state.
@martinsantibanez Yes. I will be helping people if they have problems. I will make fixes. I am also willing to implement new small features — nothing big.
from use-local-storage-state.
After some research, here are some candidate tasks:
- implementation should be based on
useSyncExternalStore
- remove manual handling of hydration mismatches.
useSyncExternalStore
should handle all that now. - remove manual handling of
activeHooks
and force updating all other hooks with the samekey
.useSyncExternalStore
will also handle this. - update tests
- decide what to do with older versions. it seems like support for both <= v17 and v18 with the same code will have some drawbacks. I should see what will be the most appropriate way to support both versions.
from use-local-storage-state.
After some research, here are some candidate tasks:
- implementation should be based on
useSyncExternalStore
- remove manual handling of hydration mismatches.
useSyncExternalStore
should handle all that now.- remove manual handling of
activeHooks
and force updating all other hooks with the samekey
.useSyncExternalStore
will also handle this.- update tests
- add tests that test support for concurrent rendering
- decide what to do with older versions. it seems like support for both <= v17 and v18 with the same code will have some drawbacks. I should see what will be the most appropriate way to support both versions.
For the last one, React team seems to provide a backwards compatible shim for useSyncExternalStore
(see this npm package). Is this suitable here?
from use-local-storage-state.
@ha-ku Yes, it is. However, I'm concerned the shim will double the bundle size of the hook which isn't a no-go but it is something worth considering.
from use-local-storage-state.
Yep, I totally agree. I will do some experiments and probably publish a beta version on npm.
from use-local-storage-state.
This is now complete. The new version supports React 18. Closing this.
from use-local-storage-state.
Hi @astoilkov
will you keep providing support for React 17?
Thanks again
from use-local-storage-state.
Related Issues (20)
- Does not respond to changes to localStorage made elsewhere in the application HOT 2
- Persist in localStorage, but do not upgrade React state HOT 5
- I have a problem using the use-local-storage-state HOT 7
- Hydration error with ssr:true using NextJS HOT 7
- need guidance for using sessionStorage also HOT 3
- Return isPossiblyHydrating HOT 4
- Usage Example contains "ssr: true", which does not appear to be a valid option HOT 1
- usage with reducer HOT 2
- Seems to be trying to fetch from local storage before window is defined in React/Next SSR environment HOT 6
- React 18: value only is available on 2nd render cycle HOT 13
- Latest version on npm is 17.3.0, rather than 18.2.0 HOT 3
- Could not find a declaration file for module 'use-local-storage-state'. HOT 4
- ✨ Make package ESM only
- block all cookies in safari breaks the hook HOT 9
- Next.js build error: targets must start with "./" HOT 2
- Migrating from `createLocalStorageStateHook` HOT 4
- Support for sessionStorage HOT 1
- Error: is not a function or its return value is not iterable HOT 2
- Suspense error when using with another library HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from use-local-storage-state.