Giter VIP home page Giter VIP logo

Comments (7)

medikoo avatar medikoo commented on August 21, 2024

@mfbx9da4 can you describe the use case?

from memoizee.

mfbx9da4 avatar mfbx9da4 commented on August 21, 2024

Suppose you have a list of items. Each item has some derived data which you would like to cache so that stays referentially identical to avoid unnecessary re-renders in React. The number of items to cache will depend on the user and will change over time. It's easy to know how big that list is at runtime and therefore trivial to know how big that cache size should be but impossible to have a good default size up front.

from memoizee.

medikoo avatar medikoo commented on August 21, 2024

@mfbx9da4 This looks to me as a use case that's best served by weak map based configuration.

So the cache is attached to an item, and if that item is disposed, then derived data you cached for it will also be disposed

from memoizee.

mfbx9da4 avatar mfbx9da4 commented on August 21, 2024

WeakMap is not available in react native

from memoizee.

medikoo avatar medikoo commented on August 21, 2024

WeakMap is not available in react native

What do you mean? WeakMap is a native JavaScript interface and this is a package that requires the JavaScript runtime to be run

from memoizee.

mfbx9da4 avatar mfbx9da4 commented on August 21, 2024

Although I haven't tested myself I saw this comment "WeakRef is not supported in Hermes or JSC on Android". I believe them!

from memoizee.

medikoo avatar medikoo commented on August 21, 2024

@mfbx9da4 memoizee under the hook doesn't use WeakRef but WeakMap, which as I search seems supported by all engines

from memoizee.

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.