0

Ok I'm at a loss. Writing a Meteor React app...it creates a collection and does that part still. I recently uploaded a currency formatter: react-currency-input from npm that did what I wanted and wrote to the mongo db, which I can access from the terminal without an issue.

But when running my app, it gives me two new reasons it crashes and I don't know why:

  1. Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.

This is weird because I am not defining proptypes anywhere in my react.

2. Uncaught TypeError: Tickets.find is not a function

It is referencing this code in the error:

export default class TicketList extends React.Component {
  constructor (props) {
      super(props);
      this.state = {
        tickets: []
      };
    }
    componentDidMount() {
      console.log('componentDidMount TicketList');
      this.ticketTracker = Tracker.autorun(() => {
        Meteor.subscribe('tickets');
        let tickets = Tickets.find({}).fetch();
        this.setState({ tickets });
      });
    }
    componentWillUnmount() {
      console.log('componentWillUnmount TicketList');
      this.ticketTracker.stop();
    }

Does anyone have any idea of where I can start looking to debug this or why I am getting these new bugs out of the blue?

3
  • 2
    First thing I'd check is if you are importing the Tickets collection properly.
    – John Smith
    Jun 3, 2017 at 6:19
  • Actually that was a good place to look! Thank you.
    – John
    Jun 3, 2017 at 19:55
  • But it's still giving me the error
    – John
    Jun 3, 2017 at 20:04

1 Answer 1

0

Yes, as @John Smith pointed out - my ticket collection was no longer a default export so I had to add the {} wherever I imported it and that solved the main issue. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.