Giter VIP home page Giter VIP logo

Comments (8)

ha-ku avatar ha-ku commented on May 18, 2024 1

@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.

astoilkov avatar astoilkov commented on May 18, 2024 1

@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.

astoilkov avatar astoilkov commented on May 18, 2024

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 same key. 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.

ha-ku avatar ha-ku commented on May 18, 2024

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 same key. 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.

astoilkov avatar astoilkov commented on May 18, 2024

@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.

astoilkov avatar astoilkov commented on May 18, 2024

Yep, I totally agree. I will do some experiments and probably publish a beta version on npm.

from use-local-storage-state.

astoilkov avatar astoilkov commented on May 18, 2024

This is now complete. The new version supports React 18. Closing this.

from use-local-storage-state.

martinsantibanez avatar martinsantibanez commented on May 18, 2024

Hi @astoilkov
will you keep providing support for React 17?

Thanks again

from use-local-storage-state.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.