Introduction to Meteor & React
- 3. What is Meteor ?
Code Demo
How is behind Meteor ?
The Plight of Meteor
The Future of Meteor
Company in Taiwan
Resources
What We’ll Cover
- 5. A full-stack, open source platform for building web and mobile apps in JavaScript
DDP Subscribe to changes in the database
MiniMongo Client-side in-memory mongodb
Tracker Rerun function when data changes
Blaze Reactive HTML templates
- 17. Load messages collection on the server
Storing messages in a collection - 2
meteor mongo
db.messages.insert( { username: "罗胖", text: "逻辑思维👍", createdAt: new Date()} )
db.messages.find({})
- 18. Connect Minimongo with React
Storing messages in a collection - 3
meteor npm install --save react-addons-pure-render-mixin
meteor add react-meteor-data
- 20. meteor mongo
db.messages.insert( { username: "TJ", text: "DDP", createdAt: new Date()} )
Storing messages in a collection - 5
DDP - Subscribe to changes in the database
- 23. Defining methods - 2
Meteor.methods({
'messages.insert': text => {
const username = 'Anonymous'
Messages.insert({
username,
text,
createAt: new Date()
})
}
})
- 24. Defining methods - 2
import '../../api/messages/methods'
Meteor.call('messages.insert', this.state.value)
import '../../api/messages/methods'
Backend
Frontend
- 25. Latency Compensation - 1
import '../../api/messages/methods'
Meteor.call('messages.insert', this.state.value)
Frontend
- 28. Latency Compensation - 2
not import method to front-end
if (Meteor.isServer) {
const d1 = Date.now()
while (Date.now() < d1 + 10000) {
// do nothing
}
}
// import '../../api/messages/methods'
- 29. Latency Compensation - 3
import '../../api/messages/methods'
import method to front-end
meteor mongo
db.messages.find()