mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Add first version of React starter app
This commit is contained in:
11
examples/react-starter/.meteor/.finished-upgraders
Normal file
11
examples/react-starter/.meteor/.finished-upgraders
Normal file
@@ -0,0 +1,11 @@
|
||||
# This file contains information which helps Meteor properly upgrade your
|
||||
# app when you run 'meteor update'. You should check it into version control
|
||||
# with your project.
|
||||
|
||||
notices-for-0.9.0
|
||||
notices-for-0.9.1
|
||||
0.9.4-platform-file
|
||||
notices-for-facebook-graph-api-2
|
||||
1.2.0-standard-minifiers-package
|
||||
1.2.0-meteor-platform-split
|
||||
1.2.0-cordova-changes
|
||||
1
examples/react-starter/.meteor/.gitignore
vendored
Normal file
1
examples/react-starter/.meteor/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
local
|
||||
22
examples/react-starter/.meteor/packages
Normal file
22
examples/react-starter/.meteor/packages
Normal file
@@ -0,0 +1,22 @@
|
||||
# Meteor packages used by this project, one per line.
|
||||
# Check this file (and the other files in this directory) into your repository.
|
||||
#
|
||||
# 'meteor add' and 'meteor remove' will edit this file for you,
|
||||
# but you can also edit it by hand.
|
||||
|
||||
meteor-base # Packages every Meteor app needs to have
|
||||
mobile-experience # Packages for a great mobile UX
|
||||
mongo # The database Meteor supports right now
|
||||
session # Client-side reactive dictionary for your app
|
||||
jquery # Helpful client-side library
|
||||
tracker # Meteor's client-side reactive programming library
|
||||
|
||||
standard-minifiers # JS/CSS minifiers run for production mode
|
||||
es5-shim # ECMAScript 5 compatibility for older browsers.
|
||||
ecmascript # Enable ECMAScript2015+ syntax in app code
|
||||
|
||||
autopublish # Publish all data to the clients (for prototyping)
|
||||
insecure # Allow all DB writes from clients (for prototyping)
|
||||
|
||||
static-html # Render static HTML content
|
||||
react # Everything you need to use React with Meteor
|
||||
2
examples/react-starter/.meteor/platforms
Normal file
2
examples/react-starter/.meteor/platforms
Normal file
@@ -0,0 +1,2 @@
|
||||
server
|
||||
browser
|
||||
1
examples/react-starter/.meteor/release
Normal file
1
examples/react-starter/.meteor/release
Normal file
@@ -0,0 +1 @@
|
||||
METEOR@1.2-rc.15
|
||||
73
examples/react-starter/.meteor/versions
Normal file
73
examples/react-starter/.meteor/versions
Normal file
@@ -0,0 +1,73 @@
|
||||
autopublish@1.0.4-rc.0
|
||||
autoupdate@1.2.3-rc.1
|
||||
babel-compiler@5.8.22-rc.1
|
||||
babel-runtime@0.1.4-rc.0
|
||||
base64@1.0.4-rc.0
|
||||
binary-heap@1.0.4-rc.0
|
||||
blaze@2.1.3-rc.0
|
||||
blaze-tools@1.0.4-rc.0
|
||||
boilerplate-generator@1.0.4-rc.1
|
||||
caching-compiler@1.0.0-rc.0
|
||||
caching-html-compiler@1.0.1-rc.0
|
||||
callback-hook@1.0.4-rc.0
|
||||
check@1.0.6-rc.0
|
||||
coffeescript@1.0.8-rc.4
|
||||
cosmos:browserify@0.4.0
|
||||
ddp@1.2.1-rc.0
|
||||
ddp-client@1.2.1-rc.2
|
||||
ddp-common@1.2.1-rc.0
|
||||
ddp-server@1.2.1-rc.2
|
||||
deps@1.0.8-rc.0
|
||||
diff-sequence@1.0.1-rc.0
|
||||
ecmascript@0.1.3-rc.3
|
||||
ecmascript-collections@0.1.5-rc.1
|
||||
ejson@1.0.7-rc.0
|
||||
es5-shim@0.1.0-rc.0
|
||||
fastclick@1.0.7-rc.0
|
||||
geojson-utils@1.0.4-rc.0
|
||||
hot-code-push@1.0.0-rc.0
|
||||
html-tools@1.0.5-rc.0
|
||||
htmljs@1.0.5-rc.1
|
||||
http@1.1.1-rc.1
|
||||
id-map@1.0.4-rc.0
|
||||
insecure@1.0.4-rc.0
|
||||
jquery@1.11.4-rc.0
|
||||
jsx@0.2.1
|
||||
launch-screen@1.0.3-rc.1
|
||||
livedata@1.0.14-rc.0
|
||||
logging@1.0.8-rc.1
|
||||
meteor@1.1.7-rc.2
|
||||
meteor-base@1.0.1-rc.0
|
||||
minifiers@1.1.6-rc.1
|
||||
minimongo@1.0.9-rc.0
|
||||
mobile-experience@1.0.1-rc.0
|
||||
mobile-status-bar@1.0.5-rc.1
|
||||
mongo@1.1.1-rc.4
|
||||
mongo-id@1.0.1-rc.0
|
||||
npm-mongo@1.4.39-rc.0_1
|
||||
observe-sequence@1.0.7-rc.0
|
||||
ordered-dict@1.0.4-rc.0
|
||||
promise@0.4.8-rc.0
|
||||
random@1.0.4-rc.0
|
||||
react@0.1.12
|
||||
react-meteor-data@0.1.8
|
||||
react-runtime@0.13.3_6
|
||||
react-runtime-dev@0.13.3_5
|
||||
react-runtime-prod@0.13.3_4
|
||||
reactive-dict@1.1.1-rc.0
|
||||
reactive-var@1.0.6-rc.0
|
||||
reload@1.1.4-rc.0
|
||||
retry@1.0.4-rc.0
|
||||
routepolicy@1.0.6-rc.0
|
||||
session@1.1.1-rc.0
|
||||
spacebars@1.0.7-rc.0
|
||||
spacebars-compiler@1.0.7-rc.0
|
||||
standard-minifiers@1.0.0-rc.2
|
||||
static-html@1.0.0-rc.5
|
||||
templating-tools@1.0.0-rc.0
|
||||
tracker@1.0.8-rc.0
|
||||
ui@1.0.7-rc.0
|
||||
underscore@1.0.4-rc.0
|
||||
url@1.0.5-rc.0
|
||||
webapp@1.2.2-rc.3
|
||||
webapp-hashing@1.0.4-rc.0
|
||||
11
examples/react-starter/index.html
Normal file
11
examples/react-starter/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<head>
|
||||
<title>react-skel</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Welcome to Meteor and React!</h1>
|
||||
|
||||
<p><a href="https://www.meteor.com/tutorials/react">Try the tutorial!</a></p>
|
||||
|
||||
<div id="react-container"></div>
|
||||
</body>
|
||||
65
examples/react-starter/index.jsx
Normal file
65
examples/react-starter/index.jsx
Normal file
@@ -0,0 +1,65 @@
|
||||
// A collection that is synchronized across client and server with the
|
||||
// 'autopublish' package. To control where the data is accessible from, remove
|
||||
// 'autopublish' and use Meteor.publish and Meteor.subscribe
|
||||
Items = new Mongo.Collection("items");
|
||||
|
||||
// A React component, defined in the normal way
|
||||
App = React.createClass({
|
||||
mixins: [ReactMeteorData],
|
||||
|
||||
// Load data from collections inside this special method enabled by the
|
||||
// ReactMeteorData mixin. The results are attached to this.data on the
|
||||
// component
|
||||
getMeteorData() {
|
||||
return {
|
||||
items: Items.find().fetch()
|
||||
};
|
||||
},
|
||||
|
||||
addItem() {
|
||||
const nextIndex = Items.find().count() + 1;
|
||||
|
||||
// We can insert from the client because we have the 'insecure' package
|
||||
// installed. Remove it and use Meteor methods for better security
|
||||
Items.insert({
|
||||
text: "Hello world! " + nextIndex
|
||||
});
|
||||
},
|
||||
|
||||
renderItems() {
|
||||
return this.data.items.map((item) => {
|
||||
return (
|
||||
<li key={item._id}>
|
||||
{item.text}
|
||||
</li>
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<ul>
|
||||
{this.renderItems()}
|
||||
</ul>
|
||||
|
||||
<button onClick={this.addItem}>
|
||||
Add item
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
if (Meteor.isClient) {
|
||||
// Code here runs on the client only
|
||||
|
||||
Meteor.startup(() => {
|
||||
// Make sure to render after startup so the DOM is ready
|
||||
React.render(<App />, document.getElementById("react-container"));
|
||||
});
|
||||
}
|
||||
|
||||
if (Meteor.isServer) {
|
||||
// Code inside here will run on the server only
|
||||
}
|
||||
1
examples/react-starter/style.css
Normal file
1
examples/react-starter/style.css
Normal file
@@ -0,0 +1 @@
|
||||
/* CSS declarations go here */
|
||||
Reference in New Issue
Block a user