Сначала использовал createContainer для подписки данных, но выдает ошибку с именем:
Uncaught TypeError: CreateContainer is not a function
react-meteor-data: React higher-order component for reactively tracking Meteor data
Warning - createContainer was deprecated in react-meteor-data@0.2.13. Use withTracker instead
Затем изменился на withTracker, но получил ошибку:
Uncaught TypeError: Employees.find is not a function
Employee_list.js
import React from 'react';
import Employees from '../../imports/collections/employees';
import { withTracker } from 'meteor/react-meteor-data';
const EmployeeList = (props) => {
console.log(props);
return(
<div>
<div className = "employee-list">
Employee list
</div>
</div>
)
}
export default withTracker ( () => {
const handle = Meteor.subscribe('employees');
//return { employeesd: Employees.find({}).fetch() };
return {
listLoading: !handle.ready(),
tasks: Employees.find({}).fetch(),
};
})( EmployeeList );
Сотрудники - моя коллекция mongodb
employees.js
import { Mongo } from 'meteor/mongo';
export const Employees = new Mongo.Collection('employees');