1.0.4 • Published 6 years ago

use-autorun v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

use-autorun

React hook for Meteor's Tracker.autorun. Use this hook to provide Tracker reactivity to your functional components:

function ExampleComponent(props) {
  // document will update whenever it changes in Minimongo
  const document = useAutorun(() =>  {
    Meteor.subscribe('mySubscription');
    return MyCollection.findOne(myDocumentID);
  });
  
  // Before the subscription is ready, document will be null
  if (!document) {
    return null;
  }
  
  return (
    <div>
      {document._id}
    </div>
  );
};
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago