Go to file
Paul O’Shannessy 5e79bd5c4f Changelog for 0.13 2015-03-10 13:47:15 -07:00
bin Expose --target flag on jsx executable 2015-02-20 13:37:42 -08:00
docs Merge pull request #3363 from zpao/0.13-docs-cloneelement 2015-03-10 13:46:12 -07:00
examples Update the examples for 0.13 2015-03-10 11:56:25 -07:00
gem-react-source BSD + PATENTS 2014-10-10 13:34:07 -07:00
grunt Update bower release task 2015-03-03 11:46:01 -08:00
jest lint from root 2015-02-20 04:06:15 +03:00
npm-jsx_orphaned_brackets_transformer lint from root 2015-02-20 04:06:15 +03:00
npm-react v0.13.0-rc2 2015-03-03 11:46:01 -08:00
npm-react-tools Documents that JSX tool is transforming files with .js extension (and not .jsx) by default 2015-01-31 20:59:18 +01:00
perf lint: remove spaces from object braces 2015-02-19 00:10:31 -05:00
scripts AUTHORS 2013-09-09 23:42:54 -07:00
src Deprecate replaceProps 2015-03-10 10:44:47 -07:00
starter Add space after ellipses 2014-09-23 17:01:23 -07:00
test eslint 2015-02-13 02:43:42 +03:00
vendor [lint] fix errors from new test 2015-03-03 11:23:45 -08:00
.editorconfig Don't forcibly wrap lines in git commit messages 2014-04-06 23:17:51 -07:00
.eslintignore lint vendor/*.js 2015-02-20 04:37:45 +03:00
.eslintrc update eslint rules 2015-02-13 02:44:32 +03:00
.gitattributes .gitattributes to ensure LF line endings when we should 2014-01-17 16:25:53 -08:00
.gitignore Minimal updates for Jekyll 2.0 2014-08-13 11:10:40 -07:00
.mailmap Update .mailmap for me 2015-01-23 11:10:22 -08:00
.travis.yml Run jest with grunt, add to travis 2015-01-27 18:04:58 -08:00
AUTHORS Update cdnjs link, include jsdelivr in readme 2014-10-28 11:06:32 -07:00
CHANGELOG.md Changelog for 0.13 2015-03-10 13:47:15 -07:00
CONTRIBUTING.md Contributing: cleanup quote style 2015-02-20 12:06:33 +02:00
Gruntfile.js eslint 2015-02-13 02:43:42 +03: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 BSD + PATENTS 2014-10-10 13:34:07 -07:00
README.md eslint 2015-02-13 02:43:42 +03:00
main.js Expose --target flag on jsx executable 2015-02-20 13:37:42 -08:00
package.json Merge pull request #3345 from zertosh/update-derequire 2015-03-09 13:46:49 -07:00

README.md

React Build Status

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 uses a virtual DOM diff implementation for ultra-high performance. It can also render on the server using Node.js — no heavy browser DOM required.
  • Data flow: React implements one-way reactive data flow which reduces boilerplate and is easier to reason about than traditional data binding.

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="http://fb.me/react-0.12.2.js"></script>
<!-- In-browser JSX transformer, remove when pre-compiling JSX. -->
<script src="http://fb.me/JSXTransformer-0.12.2.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.