I am building an app with React/Meteor and I need to check for the following thing in different components:
the idea basically is to check if the user has already made an order since yesterday 3pm. So I have to:
- Go to the Order collection
- Find the user’s last order
- check whether this order was created after 3pm.
- return true/false.
So I was thinking: what exactly is the best practice to do so ? Here are the three ideas that I have in mind but I’m a meteor beginner so maybe there are other better options I don’t know.
- Should I write a method in my api/order.js file and use
- Should I publish and subscribe ?
- or maybe write like a helper an import it in my components ?