Go to file
Paul O’Shannessy 79561342c3 Build standalone react-addons packages 2015-06-21 20:01:21 +08:00
bin Ignore third_party JS in internal transform step 2015-05-18 09:50:13 -07:00
docs Fix link of getting-started.ja-JP.md 2015-06-17 22:17:47 +09:00
eslint-rules Load custom eslint rules as plugin, w/o --rulesdir 2015-06-04 17:04:45 -07:00
examples added missing DOCTYPE 2015-05-31 19:41:01 -07:00
gem-react-source BSD + PATENTS 2014-10-10 13:34:07 -07:00
grunt Build standalone react-addons packages 2015-06-21 20:01:21 +08:00
jest Switch to using comma-dangle: always-multiline 2015-06-02 16:57:26 -07:00
npm-react-tools SSL/TLSize all the things! (convert http:// to https:// where appropriate) 2015-04-18 16:49:32 -07:00
packages Build standalone react-addons packages 2015-06-21 20:01:21 +08:00
scripts AUTHORS 2013-09-09 23:42:54 -07:00
src Move renderSubtreeIntoContainer into ReactDOMClient 2015-06-20 18:08:33 -07:00
starter SSL/TLSize all the things! (convert http:// to https:// where appropriate) 2015-04-18 16:49:32 -07:00
test Switch to using comma-dangle: always-multiline 2015-06-02 16:57:26 -07:00
vendor Merge pull request #2981 from hzoo/jsdoc-fixes 2015-06-17 16:06:37 -07:00
.editorconfig Don't forcibly wrap lines in git commit messages 2014-04-06 23:17:51 -07:00
.eslintignore Move npm packages into folder 2015-06-17 12:01:44 -07:00
.eslintrc Merge pull request #4043 from spicyj/80 2015-06-08 10:40:42 -07:00
.gitattributes .gitattributes to ensure LF line endings when we should 2014-01-17 16:25:53 -08:00
.gitignore Autobuild website on Travis from stable branch 2015-03-30 10:56:41 -07:00
.mailmap Update AUTHORS for 0.13 2015-03-10 13:55:55 -07:00
.travis.yml Use local `grunt` executable on Travis 2015-04-28 14:45:55 -07:00
AUTHORS Update AUTHORS for 0.13 2015-03-10 13:55:55 -07:00
CHANGELOG.md Changelog for 0.13.3 2015-05-21 10:51:45 -07:00
CONTRIBUTING.md Fixed grammar in CLA section of contribution guide 2015-06-11 17:49:46 -07:00
Gruntfile.js Build standalone react-addons packages 2015-06-21 20:01:21 +08:00
LICENSE Fix Outdated Copyright Year 2015-01-05 13:52:20 -05:00
LICENSE-docs Update licenses for docs and examples 2014-10-22 12:35:08 -07:00
LICENSE-examples Update licenses for docs and examples 2014-10-22 12:35:08 -07:00
PATENTS Update Patent Grant 2015-04-10 12:15:29 -07:00
README.md Remove extra period 2015-06-12 11:29:26 -07:00
main.js Switch to using comma-dangle: always-multiline 2015-06-02 16:57:26 -07:00
package.json npm script to run lint only on changed files 2015-06-16 11:24:02 -07:00

README.md

React Build Status npm version

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.
  • 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, which uses React and JavaScript to create native mobile apps.

Learn how to use React in your own project.

Examples

We have several examples on the website. Here is the first one to get you started:

var HelloMessage = React.createClass({
  render: function() {
    return <div>Hello {this.props.name}</div>;
  }
});

React.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. 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 and jsdelivr):

<!-- The core React library -->
<script src="https://fb.me/react-0.13.3.js"></script>
<!-- In-browser JSX transformer, remove when pre-compiling JSX. -->
<script src="https://fb.me/JSXTransformer-0.13.3.js"></script>

We've also built a starter kit 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, it's as easy as:

bower install --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 v0.10.0+ (it might work at lower versions, we just haven't tested).
  • 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.

# 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:

# Build and run tests with PhantomJS
grunt test
# Build and run tests in your browser
grunt test --debug
# For speed, you can use fasttest and add --filter to only run one test
grunt fasttest --filter=ReactIdentity
# Lint the code with ESLint
grunt lint
# Wipe out build directory
grunt clean

License

React is BSD licensed. We also provide an additional patent grant.

React documentation is Creative Commons licensed.

Examples provided in this repository and in the documentation are separately licensed.

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.

Troubleshooting

See the Troubleshooting Guide