Попытка реализовать 'реакции-метеорит-хуки, но переменная' загрузки 'всегда верна:
import React from 'react';
import { useSubscription, useMongoFetch } from 'react-meteor-hooks';
import { Comments } from '../../../../collections/comments';
export const GiveComments = (props) => {
const loading = useSubscription('getComments');
if (loading) {
console.log('loading... ');
} else {
const allComments = useMongoFetch(Comments.find({}));
console.log('loaded: ', allComments);
}
return (null);
};
Публикация:
Meteor.publish('getComments', function() {
return Comments.find({});
});
Эти хуки выглядят потрясающе, но могут'заставить его работать. Почему «загрузка» не останавливается?