1.0.4 • Published 4 years ago

use-autorun v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 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

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago