Code Monkey home page Code Monkey logo

Comments (6)

arunoda avatar arunoda commented on August 17, 2024 1

This is not possible with React. This is only something works in Blaze.
Have you done a performance test?
Usually this won't be an issue in React.

from mantra-sample-blog-app.

arunoda avatar arunoda commented on August 17, 2024

Could you give more context to this ?

from mantra-sample-blog-app.

merlinpatt avatar merlinpatt commented on August 17, 2024

In core/containers/postlist.js, there is this line

const posts = Collections.Posts.find().fetch();

from mantra-sample-blog-app.

arunoda avatar arunoda commented on August 17, 2024

That's the way we do it. We called .find() here. So, whenever there's a change inside to the collection, you'll get data.

from mantra-sample-blog-app.

merlinpatt avatar merlinpatt commented on August 17, 2024

But why not just do it without the fetch?

const posts = Collections.Posts.find();

To me, it seems like fetch would become inefficient for large sets of data because it's returning all the data at once.

from mantra-sample-blog-app.

newswim avatar newswim commented on August 17, 2024

Fetch assigns dependencies and is in fact reactive. From the docs:

Cursors are a reactive data source. On the client, the first time you retrieve a cursor’s documents with fetch, map, or forEach inside a reactive computation (eg, a template or autorun), Meteor will register a dependency on the underlying data. Any change to the collection that changes the documents in a cursor will trigger a recomputation. To disable this behavior, pass {reactive: false} as an option to find.

from mantra-sample-blog-app.

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.