Giter VIP home page Giter VIP logo

Comments (1)

brianegan avatar brianegan commented on June 12, 2024

Hey there -- not sure if you were still curious since the issue is closed, but you could definitely do that!

I don't quite have the time to code up an entire example, but as a general idea: You need to turn each item in the List from a Todo into a TodoModel. Each item in the list should listen to the Todo Model for changes, and rebuild when it changes. The List itself still needs to listen for changes as well! However, rather than notifying it's listeners when an item changes, it would only need to notify listeners when an item is added or removed (so the entire list can be recalculated at that point, since an item could be inserted or removed at any index).

Overall, I actually tried that approach as well, but it led to the code being a bit more complicated in the end and wasn't any faster on an old device that I was playing with. Therefore, I kept the example a bit simpler. Perhaps on an app that displays very large or infinite lists, it'd be a good idea to perform that optimization and pay the price of managing a bit more code!

from scoped_model.

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.