These are chat archives for SmartFocus/reactjs

16th
Jan 2016
Sami Ghayeni
@aseds
Jan 16 2016 03:21

hi guys, i'm trying to glue ddp and ddp-server-reactive to make something like Meteor but without using Meteor!
can somebody tell me what i should do please? in meteor, if data changes on the database, React shows that change.(i think by rerendering)
i'm new to React. say i do this using ddp:

    'posts', 
    [],                       // any parameters used by the Publish function 
    function () {             // callback when the subscription is complete 
      console.log('posts complete:');
      console.log(ddpclient.collections.posts);
    }
  );

so after i subscribe, if posts changes on the server, the callback of ddbclient.subscribe() get's called. but how do i make React to rerender when this change happen?

sorry, the code is this:
    'posts',                  // name of Meteor Publish function to subscribe to 
    [],                       // any parameters used by the Publish function 
    function () {             // callback when the subscription is complete 
      console.log('posts complete:');
      console.log(ddpclient.collections.posts);
    }
  );
oh god!
ddpclient.subscribe(
    'posts',                  // name of Meteor Publish function to subscribe to 
    [],                       // any parameters used by the Publish function 
    function () {             // callback when the subscription is complete 
      console.log('posts complete:');
      console.log(ddpclient.collections.posts);
    }
  );
and i'm using Express.js. i have not figured out how to connect ddp to Mongodb, i first wanted to know it its possible on the client-side. thank you very much for your time.