Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
41,770 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
node_modules/ | ||
.sass-cache | ||
|
||
# Compiled source # | ||
################### | ||
*.com | ||
*.class | ||
*.dll | ||
*.exe | ||
*.o | ||
*.so | ||
*.pyc | ||
|
||
# Logs and databases # | ||
###################### | ||
*.log | ||
|
||
# OS generated files # | ||
###################### | ||
.DS_Store* | ||
ehthumbs.db | ||
Icon? | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,116 @@ | ||
# react-tutorial | ||
examples that a create in my blog | ||
# [React](https://facebook.github.io/react/) [![Build Status](https://img.shields.io/travis/facebook/react/master.svg?style=flat)](https://travis-ci.org/facebook/react) [![Coverage Status](https://img.shields.io/coveralls/facebook/react/master.svg?style=flat)](https://coveralls.io/github/facebook/react?branch=master) [![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/react) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests) | ||
|
||
React is a JavaScript library for building user interfaces. | ||
|
||
* **Just the UI:** Lots of people use React as the V in MVC. Since React makes no assumptions about the rest of your technology stack, it's easy to try it out on a small feature in an existing project. | ||
* **Virtual DOM:** React abstracts away the DOM from you, giving a simpler programming model and better performance. React can also render on the server using Node, and it can power native apps using [React Native](https://facebook.github.io/react-native/). | ||
* **Data flow:** React implements one-way reactive data flow which reduces boilerplate and is easier to reason about than traditional data binding. | ||
|
||
**NEW**! Check out our newest project [React Native](https://github.com/facebook/react-native), which uses React and JavaScript to create native mobile apps. | ||
|
||
[Learn how to use React in your own project](https://facebook.github.io/react/docs/getting-started.html). | ||
|
||
## Examples | ||
|
||
We have several examples [on the website](https://facebook.github.io/react/). Here is the first one to get you started: | ||
|
||
```js | ||
var HelloMessage = React.createClass({ | ||
render: function() { | ||
return <div>Hello {this.props.name}</div>; | ||
} | ||
}); | ||
|
||
ReactDOM.render( | ||
<HelloMessage name="John" />, | ||
document.getElementById('container') | ||
); | ||
``` | ||
|
||
This example will render "Hello John" into a container on the page. | ||
|
||
You'll notice that we used an HTML-like syntax; [we call it JSX](https://facebook.github.io/react/docs/jsx-in-depth.html). JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML. A simple transform is included with React that allows converting JSX into native JavaScript for browsers to digest. | ||
|
||
## Installation | ||
|
||
The fastest way to get started is to serve JavaScript from the CDN (also available on [cdnjs](https://cdnjs.com/libraries/react) and [jsdelivr](https://www.jsdelivr.com/projects/react)): | ||
|
||
```html | ||
<!-- The core React library --> | ||
<script src="https://fb.me/react-15.1.0.js"></script> | ||
<!-- The ReactDOM Library --> | ||
<script src="https://fb.me/react-dom-15.1.0.js"></script> | ||
``` | ||
|
||
We've also built a [starter kit](https://facebook.github.io/react/downloads/react-15.1.0.zip) which might be useful if this is your first time using React. It includes a webpage with an example of using React with live code. | ||
|
||
If you'd like to use [bower](http://bower.io), it's as easy as: | ||
|
||
```sh | ||
bower install --save react | ||
``` | ||
|
||
And it's just as easy with [npm](http://npmjs.com): | ||
|
||
```sh | ||
npm i --save react | ||
``` | ||
|
||
## Contribute | ||
|
||
The main purpose of this repository is to continue to evolve React core, making it faster and easier to use. If you're interested in helping with that, then keep reading. If you're not interested in helping right now that's ok too. :) Any feedback you have about using React would be greatly appreciated. | ||
|
||
### Building Your Copy of React | ||
|
||
The process to build `react.js` is built entirely on top of node.js, using many libraries you may already be familiar with. | ||
|
||
#### Prerequisites | ||
|
||
* You have `node` installed at v4.0.0+ and `npm` at v2.0.0+. | ||
* You are familiar with `npm` and know whether or not you need to use `sudo` when installing packages globally. | ||
* You are familiar with `git`. | ||
|
||
#### Build | ||
|
||
Once you have the repository cloned, building a copy of `react.js` is really easy. | ||
|
||
```sh | ||
# grunt-cli is needed by grunt; you might have this installed already | ||
npm install -g grunt-cli | ||
npm install | ||
grunt build | ||
``` | ||
|
||
At this point, you should now have a `build/` directory populated with everything you need to use React. The examples should all work. | ||
|
||
### Grunt | ||
|
||
We use grunt to automate many tasks. Run `grunt -h` to see a mostly complete listing. The important ones to know: | ||
|
||
```sh | ||
# Build and run tests with PhantomJS | ||
grunt test | ||
# Lint the code with ESLint | ||
grunt lint | ||
# Wipe out build directory | ||
grunt clean | ||
``` | ||
|
||
### Good First Bug | ||
To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first bugs](https://github.com/facebook/react/labels/good%20first%20bug) that contain bugs which are fairly easy to fix. This is a great place to get started. | ||
|
||
|
||
### License | ||
|
||
React is [BSD licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS). | ||
|
||
React documentation is [Creative Commons licensed](./LICENSE-docs). | ||
|
||
Examples provided in this repository and in the documentation are [separately licensed](./LICENSE-examples). | ||
|
||
### More… | ||
|
||
There's only so much we can cram in here. To read more about the community and guidelines for submitting pull requests, please read the [Contributing document](CONTRIBUTING.md). | ||
|
||
## Troubleshooting | ||
See the [Troubleshooting Guide](https://github.com/facebook/react/wiki/Troubleshooting) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* ReactDOMServer v15.1.0 | ||
* | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js | ||
;(function(f) { | ||
// CommonJS | ||
if (typeof exports === "object" && typeof module !== "undefined") { | ||
module.exports = f(require('react')); | ||
|
||
// RequireJS | ||
} else if (typeof define === "function" && define.amd) { | ||
define(['react'], f); | ||
|
||
// <script> | ||
} else { | ||
var g; | ||
if (typeof window !== "undefined") { | ||
g = window; | ||
} else if (typeof global !== "undefined") { | ||
g = global; | ||
} else if (typeof self !== "undefined") { | ||
g = self; | ||
} else { | ||
// works providing we're not in "use strict"; | ||
// needed for Java 8 Nashorn | ||
// see https://github.com/facebook/react/issues/3037 | ||
g = this; | ||
} | ||
g.ReactDOMServer = f(g.React); | ||
} | ||
|
||
})(function(React) { | ||
return React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* ReactDOMServer v15.1.0 | ||
* | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,f.ReactDOMServer=e(f.React)}}(function(e){return e.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* ReactDOM v15.1.0 | ||
* | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js | ||
;(function(f) { | ||
// CommonJS | ||
if (typeof exports === "object" && typeof module !== "undefined") { | ||
module.exports = f(require('react')); | ||
|
||
// RequireJS | ||
} else if (typeof define === "function" && define.amd) { | ||
define(['react'], f); | ||
|
||
// <script> | ||
} else { | ||
var g; | ||
if (typeof window !== "undefined") { | ||
g = window; | ||
} else if (typeof global !== "undefined") { | ||
g = global; | ||
} else if (typeof self !== "undefined") { | ||
g = self; | ||
} else { | ||
// works providing we're not in "use strict"; | ||
// needed for Java 8 Nashorn | ||
// see https://github.com/facebook/react/issues/3037 | ||
g = this; | ||
} | ||
g.ReactDOM = f(g.React); | ||
} | ||
|
||
})(function(React) { | ||
return React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* ReactDOM v15.1.0 | ||
* | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
*/ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,f.ReactDOM=e(f.React)}}(function(e){return e.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED}); |
Oops, something went wrong.