diff --git a/blog/2013/06/02/jsfiddle-integration.html b/blog/2013/06/02/jsfiddle-integration.html new file mode 100644 index 0000000000..2ea6db6642 --- /dev/null +++ b/blog/2013/06/02/jsfiddle-integration.html @@ -0,0 +1,101 @@ + + + + + + React | JSFiddle Integration + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + +
+

JSFiddle Integration

+

June 2, 2013 by Christopher Chedeau

+ +
+ +
+

JSFiddle just announced support for React. This is an exciting news as it makes collaboration on snippets of code a lot easier. You can play around this base React JSFiddle, fork it and share it! A fiddle without JSX is also available.

+ + + + + +
+
+
+ + + +
+ + + + diff --git a/blog/2013/06/05/why-react.html b/blog/2013/06/05/why-react.html new file mode 100644 index 0000000000..23f2015786 --- /dev/null +++ b/blog/2013/06/05/why-react.html @@ -0,0 +1,187 @@ + + + + + + React | Why did we build React? + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + +
+

Why did we build React?

+

June 5, 2013 by Pete Hunt

+ +
+ +
+

There are a lot of JavaScript MVC frameworks out there. Why did we build React +and why would you want to use it?

+ +

React isn't an MVC framework.

+ +

React is a library for building composable user interfaces. It encourages +the creation of reusable UI components which present data that changes over +time.

+ +

React doesn't use templates.

+ +

Traditionally, web application UIs are built using templates or HTML directives. +These templates dictate the full set of abstractions that you are allowed to use +to build your UI.

+ +

React approaches building user interfaces differently by breaking them into +components. This means React uses JavaScript to generate markup, which we +see as an advantage over templates for a few reasons:

+ +
    +
  • JavaScript is a flexible, powerful programming language with the ability +to build abstractions. This is incredibly important in large applications.
  • +
  • By unifying your markup with it's corresponding view logic, React can actually +make views easier to extend and maintain.
  • +
  • By baking an understanding of markup and content into JavaScript, there's +no manual string concatenation and therefore less surface area for XSS +vulnerabilities.
  • +
+ +

We've also created JSX, an optional +syntax extension, in case you prefer the readability of HTML to raw JavaScript.

+ +

Reactive updates are dead simple.

+ +

React really shines when your data changes over time.

+ +

In a traditional JavaScript application, you need to look at what data changed +and imperatively make changes to the DOM to keep it up-to-date. Even AngularJS, +which provides a declarative interface via directives and data binding requires +a linking function to manually update DOM nodes.

+ +

React takes a different approach.

+ +

When your component is first initialized, the render method is called, +generating a lightweight representation of your view. From that representation, +a string of markup is produced, and injected into the document. When your data +changes, the render method is called again. In order to perform updates as +efficiently as possible, we diff the return value from the previous call to +render with the new one, and generate a minimal set of changes to be applied +to the DOM.

+ +
+

The data returned from render is neither a string nor a DOM node -- it's a +lightweight description of what the DOM should look like.

+
+ +

We call this process reconciliation. Check out +this jsFiddle to see an example of +reconciliation in action.

+ +

Because this re-render is so fast (around 1ms for TodoMVC), the developer +doesn't need to explicitly specify data bindings. We've found this approach +makes it easier to build apps.

+ +

HTML is just the beginning.

+ +

Because React has its own lightweight representation of the document, we can do +some pretty cool things with it:

+ +
    +
  • Facebook has dynamic charts that render to <canvas> instead of HTML.
  • +
  • Instagram is a "single page" web app built entirely with React and +Backbone.Router. Designers regularly contribute React code with JSX.
  • +
  • We've built internal prototypes that run React apps in a web worker and use +React to drive native iOS views via an Objective-C bridge.
  • +
  • You can run React +on the server +for SEO, performance, code sharing and overall flexibility.
  • +
  • Events behave in a consistent, standards-compliant way in all browsers +(including IE8) and automatically use +event delegation.
  • +
+ +

Head on over to +facebook.github.io/react to check +out what we have built. Our documentation is geared towards building +apps with the framework, but if you are interested in the +nuts and bolts +get in touch with us!

+ +

Thanks for reading!

+ +
+
+
+ + + +
+ + + + diff --git a/blog/index.html b/blog/index.html new file mode 100644 index 0000000000..e2c567b1f2 --- /dev/null +++ b/blog/index.html @@ -0,0 +1,124 @@ + + + + + + React | Blog + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + +
+ +
+

Why did we build React?

+

June 5, 2013 by Pete Hunt

+ +
+ +
+

There are a lot of JavaScript MVC frameworks out there. Why did we build React +and why would you want to use it?

+ + +

+ Continue Reading → +

+ +
+
+ +
+

JSFiddle Integration

+

June 2, 2013 by Christopher Chedeau

+ +
+ +
+

JSFiddle just announced support for React. This is an exciting news as it makes collaboration on snippets of code a lot easier. You can play around this base React JSFiddle, fork it and share it! A fiddle without JSX is also available.

+ + +

+ Continue Reading → +

+ +
+
+ +
+
+ + + +
+ + + + diff --git a/css/react.css b/css/react.css index 1456710d23..de1a8e9c25 100644 --- a/css/react.css +++ b/css/react.css @@ -1 +1 @@ -html{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-family:proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#484848;line-height:1.28}p{margin:0 0 10px}.subHeader{font-size:21px;font-weight:200;line-height:30px;margin-bottom:10px}em{font-style:italic}h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#7b7b7b}h1,h2,h3{line-height:40px}h1{font-size:39px}h2{font-size:31px}h3{font-size:23px}h4{font-size:17px}h5{font-size:14px}h6{font-size:11px}h1 small{font-size:24px}h2 small{font-size:18px}h3 small{font-size:16px}h4 small{font-size:14px}ul,ol{margin:0 0 10px 25px;padding:0}ul ul,ul ol,ol ol,ol ul{margin-bottom:0}li{line-height:20px}a{color:#c05b4d;text-decoration:none}a:hover,a:focus{color:#a5473a;text-decoration:underline}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.center{text-align:center}html *{color-profile:sRGB;rendering-intent:auto}.cm-s-solarized-light{background-color:#f8f5ec;color:#637c84}.cm-s-solarized-light .emphasis{font-weight:bold}.cm-s-solarized-light .dotted{border-bottom:1px dotted #cb4b16}.cm-s-solarized-light .CodeMirror-gutter{background-color:#eee8d5;border-right:3px solid #eee8d5}.cm-s-solarized-light .CodeMirror-gutter .CodeMirror-gutter-text{color:#93a1a1}.cm-s-solarized-light .CodeMirror-cursor{border-left-color:#002b36 !important}.cm-s-solarized-light .CodeMirror-matchingbracket{color:#002b36;background-color:#eee8d5;box-shadow:0 0 10px #eee8d5;font-weight:bold}.cm-s-solarized-light .CodeMirror-nonmatchingbracket{color:#002b36;background-color:#eee8d5;box-shadow:0 0 10px #eee8d5;font-weight:bold;color:#dc322f;border-bottom:1px dotted #cb4b16}.cm-s-solarized-light span.cm-keyword{color:#268bd2}.cm-s-solarized-light span.cm-atom{color:#2aa198}.cm-s-solarized-light span.cm-number{color:#586e75}.cm-s-solarized-light span.cm-def{color:#637c84}.cm-s-solarized-light span.cm-variable{color:#637c84}.cm-s-solarized-light span.cm-variable-2{color:#b58900}.cm-s-solarized-light span.cm-variable-3{color:#cb4b16}.cm-s-solarized-light span.cm-comment{color:#93a1a1}.cm-s-solarized-light span.cm-property{color:#637c84}.cm-s-solarized-light span.cm-operator{color:#657b83}.cm-s-solarized-light span.cm-string{color:#36958e}.cm-s-solarized-light span.cm-error{font-weight:bold;border-bottom:1px dotted #cb4b16}.cm-s-solarized-light span.cm-bracket{color:#cb4b16}.cm-s-solarized-light span.cm-tag{color:#657b83}.cm-s-solarized-light span.cm-attribute{color:#586e75;font-weight:bold}.cm-s-solarized-light span.cm-meta{color:#268bd2}.cm-s-solarized-dark{background-color:#002b36;color:#839496}.cm-s-solarized-dark .emphasis{font-weight:bold}.cm-s-solarized-dark .dotted{border-bottom:1px dotted #cb4b16}.cm-s-solarized-dark .CodeMirror-gutter{background-color:#073642;border-right:3px solid #073642}.cm-s-solarized-dark .CodeMirror-gutter .CodeMirror-gutter-text{color:#586e75}.cm-s-solarized-dark .CodeMirror-cursor{border-left-color:#fdf6e3 !important}.cm-s-solarized-dark .CodeMirror-matchingbracket{color:#fdf6e3;background-color:#073642;box-shadow:0 0 10px #073642;font-weight:bold}.cm-s-solarized-dark .CodeMirror-nonmatchingbracket{color:#fdf6e3;background-color:#073642;box-shadow:0 0 10px #073642;font-weight:bold;color:#dc322f;border-bottom:1px dotted #cb4b16}.cm-s-solarized-dark span.cm-keyword{color:#839496;font-weight:bold}.cm-s-solarized-dark span.cm-atom{color:#2aa198}.cm-s-solarized-dark span.cm-number{color:#93a1a1}.cm-s-solarized-dark span.cm-def{color:#268bd2}.cm-s-solarized-dark span.cm-variable{color:#cb4b16}.cm-s-solarized-dark span.cm-variable-2{color:#cb4b16}.cm-s-solarized-dark span.cm-variable-3{color:#cb4b16}.cm-s-solarized-dark span.cm-comment{color:#586e75}.cm-s-solarized-dark span.cm-property{color:#b58900}.cm-s-solarized-dark span.cm-operator{color:#839496}.cm-s-solarized-dark span.cm-string{color:#6c71c4}.cm-s-solarized-dark span.cm-error{font-weight:bold;border-bottom:1px dotted #cb4b16}.cm-s-solarized-dark span.cm-bracket{color:#cb4b16}.cm-s-solarized-dark span.cm-tag{color:#839496}.cm-s-solarized-dark span.cm-attribute{color:#93a1a1;font-weight:bold}.cm-s-solarized-dark span.cm-meta{color:#268bd2}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border:none;margin:0;padding:0}html{background:#f9f9f9}.left{float:left}.right{float:right}.container{padding-top:50px;min-width:960px}.wrap{width:960px;margin-left:auto;margin-right:auto;padding-left:20px;padding-right:20px}.skinnyWrap{width:690px;margin-left:auto;margin-right:auto;padding-left:20px;padding-right:20px}hr{height:0;border-top:1px solid #ccc;border-bottom:1px solid #eee}ul,li{margin-left:20px}.nav-main{*zoom:1;background:#222;color:#fafafa;position:fixed;top:0;height:50px;box-shadow:0 0 5px rgba(0,0,0,0.5);width:100%;z-index:100}.nav-main:before,.nav-main:after{content:" ";display:table}.nav-main:after{clear:both}.nav-main a{color:#e9e9e9;text-decoration:none}.nav-main .nav-site{float:right;margin:0}.nav-main .nav-site li{margin:0}.nav-main .nav-site a{padding:0 8px;text-transform:uppercase;letter-spacing:1px;line-height:50px;display:inline-block;height:50px;color:#aaa}.nav-main .nav-site a:hover{color:#fafafa}.nav-main .nav-site a.active{color:#fafafa;border-bottom:3px solid #cc7a6f;background:#333}.nav-main .nav-home{color:#00d8ff;font-size:24px;line-height:50px}.nav-main .nav-logo{background-image:url("../img/logo_small.png");vertical-align:middle}@media only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 1.3 / 1), only screen and (min-resolution: 125dpi), only screen and (min-resolution: 1.3dppx){.nav-main .nav-logo{background-image:url("../img/logo_small@2x.png");background-size:38px 38px}}.nav-main ul{display:inline}.nav-main li{display:inline}.hero{height:300px;background:#2d2d2d;padding-top:50px;color:#e9e9e9;font-weight:300}.hero .text{font-size:64px;text-align:center}.hero .minitext{font-size:16px;text-align:center;text-transform:uppercase}.hero strong{color:#61dafb;font-weight:400}.buttons-unit{margin-top:60px;text-align:center}.buttons-unit a{color:#61dafb}.buttons-unit .button{font-size:24px;background:#cc7a6f;color:#fafafa}.buttons-unit .button:active{background:#c5695c}.buttons-unit.downloads{margin:30px 0}.nav-docs{color:#2d2d2d;font-size:14px;float:left;top:100px;width:180px}.nav-docs ul{list-style:none;margin:0}.nav-docs li{margin:0}.nav-docs h3{text-transform:uppercase;font-size:14px}.nav-docs a{color:#666;display:block}.nav-docs a:hover{text-decoration:none;color:#cc7a6f}.nav-docs a.active{color:#cc7a6f}.nav-docs .nav-docs-section{border-bottom:1px solid #ccc;border-top:1px solid #eee;padding:12px 0}.nav-docs .nav-docs-section:first-child{padding-top:0;border-top:0}.nav-docs .nav-docs-section:last-child{padding-bottom:0;border-bottom:0}.home-section{margin:50px 0}.home-divider{border-top-color:#bbb;margin:0 auto;width:400px}.marketing-row{*zoom:1;margin:50px 0}.marketing-row:before,.marketing-row:after{content:" ";display:table}.marketing-row:after{clear:both}.marketing-col{float:left;margin-right:40px;width:280px}.marketing-col h3{color:#2d2d2d;font-size:24px;font-weight:normal;text-transform:uppercase}.marketing-col p{font-size:16px}.marketing-col:last-child{margin-right:0}#examples h3{color:#2d2d2d;font-size:24px;font-weight:normal;margin-bottom:5px}#examples p{margin:0 0 25px 0;max-width:600px}#examples .example{margin-top:60px}#examples #todoExample{font-size:14px}#examples #todoExample ul{list-style-type:square;margin:0 0 10px 0}#examples #todoExample input{border:1px solid #ccc;font:14px proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;padding:3px;width:150px}#examples #todoExample button{font:14px proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;margin-left:5px;padding:4px 10px}#examples #markdownExample textarea{border:1px solid #ccc;font:14px proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;margin-bottom:10px;padding:5px}.home-bottom-section{margin-bottom:100px}.docs-nextprev{*zoom:1}.docs-nextprev:before,.docs-nextprev:after{content:" ";display:table}.docs-nextprev:after{clear:both}.docs-prev{float:left}.docs-next{float:right}footer{font-size:13px;font-weight:600;margin-top:36px;margin-bottom:18px;overflow:auto}section.black content{padding-bottom:18px}.documentationContent{*zoom:1;padding-top:20px}.documentationContent:before,.documentationContent:after{content:" ";display:table}.documentationContent:after{clear:both}.documentationContent .subHeader{font-size:24px}.documentationContent h2{margin-top:30px}.documentationContent blockquote{padding:15px 30px 15px 15px;margin:20px 0;background-color:rgba(204,122,111,0.1);border-left:5px solid rgba(191,87,73,0.2)}.documentationContent blockquote h4{margin-top:0}.documentationContent blockquote p:last-child{margin-bottom:0}.documentationContent blockquote p:first-child{font-weight:bold;font-size:17.5px;line-height:20px;margin-top:0;text-rendering:optimizelegibility}.docs-prevnext{padding-top:40px;padding-bottom:40px}.jsxCompiler{margin:0 auto;padding-top:20px;width:1220px}.jsxCompiler #jsxCompiler{margin-top:20px}.jsxCompiler .playgroundPreview{padding:14px;width:600px}.jsxCompiler .playgroundPreview pre{font-family:'source-code-pro', Menlo, 'Courier New', Consolas, monospace;font-size:13px;line-height:20px}.button{background:-webkit-linear-gradient( #9a9a9a,#646464);background:linear-gradient( #9a9a9a,#646464);border-radius:4px;padding:8px 16px;font-size:18px;font-weight:400;margin:0 12px;display:inline-block;color:#fafafa;text-decoration:none;text-shadow:0 1px 3px rgba(0,0,0,0.3);box-shadow:0 1px 1px rgba(0,0,0,0.2);text-decoration:none}.button:hover{text-decoration:none}.button:active{box-shadow:none}.hero .button{box-shadow:1px 3px 3px rgba(0,0,0,0.3)}.button.blue{background:-webkit-linear-gradient( #77a3d2,#4783c2);background:linear-gradient( #77a3d2,#4783c2)}.row{padding-bottom:4px}.row .span4{width:33.33%;display:table-cell}.row .span8{width:66.66%;display:table-cell}.row .span6{width:50%;display:table-cell}p{margin:10px 0}.highlight{padding:10px;margin-bottom:20px}.inner-content{float:right;width:650px}.nosidebar .inner-content{float:none;margin:0 auto}div.CodeMirror pre,div.CodeMirror-linenumber,code{font-family:'source-code-pro', Menlo, 'Courier New', Consolas, monospace;font-size:13px;line-height:20px}div.CodeMirror-linenumber:after{content:'.'}.CodeMirror,div.CodeMirror-gutters,div.highlight{border:none}small code,li code,p code{color:#555;background-color:rgba(0,0,0,0.04);padding:1px 3px}.cm-s-default span.cm-string-2{color:inherit}.playground{*zoom:1}.playground:before,.playground:after{content:" ";display:table}.playground:after{clear:both}.playground::before{border-bottom:none !important;border-radius:3px 3px 0 0;padding:3px 7px;font-size:12px;font-weight:bold;color:#c2c0bc;background-color:#f1ede4;content:'Live editor'}.playground::before,.playgroundCode,.playgroundPreview{border:1px solid rgba(16,16,16,0.1)}.playgroundCode{border-radius:0 3px 3px 3px;float:left;overflow:hidden;width:600px}.playgroundPreview{background-color:white;border-radius:3px;float:right;padding:15px 20px;width:280px}.MarkdownEditor textarea{width:100%;height:100px}.hll{background-color:#f7ebc6;border-left:5px solid #f7d87c;display:block;margin-left:-14px;margin-right:-14px;padding-left:9px}.highlight .javascript .err{background-color:transparent;color:inherit}.highlight{position:relative;margin-bottom:14px;padding:30px 14px 14px;border:none;border-radius:0;overflow:auto}.highlight pre{padding:0;margin-top:0;margin-bottom:0;background-color:transparent;border:0}.highlight pre code{font-size:inherit}.highlight pre .lineno{display:inline-block;width:22px;padding-right:5px;margin-right:10px;color:#bebec5;text-align:right}.highlight:after{position:absolute;top:0;right:0;left:0;padding:3px 7px;font-size:12px;font-weight:bold;color:#c2c0bc;background-color:#f1ede4;content:"Code"}.downloadCenter{text-align:center;margin-top:20px;margin-bottom:25px}.downloadSection:hover{text-decoration:none !important}@media screen and (max-width: 960px){.nav-main{position:static}.container{padding-top:0}} +html{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-family:proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:300;color:#484848;line-height:1.28}p{margin:0 0 10px}.subHeader{font-size:21px;font-weight:200;line-height:30px;margin-bottom:10px}em{font-style:italic}h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#7b7b7b}h1,h2,h3{line-height:40px}h1{font-size:39px}h2{font-size:31px}h3{font-size:23px}h4{font-size:17px}h5{font-size:14px}h6{font-size:11px}h1 small{font-size:24px}h2 small{font-size:18px}h3 small{font-size:16px}h4 small{font-size:14px}ul,ol{margin:0 0 10px 25px;padding:0}ul ul,ul ol,ol ol,ol ul{margin-bottom:0}li{line-height:20px}a{color:#c05b4d;text-decoration:none}a:hover,a:focus{color:#a5473a;text-decoration:underline}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.center{text-align:center}html *{color-profile:sRGB;rendering-intent:auto}.cm-s-solarized-light{background-color:#f8f5ec;color:#637c84}.cm-s-solarized-light .emphasis{font-weight:bold}.cm-s-solarized-light .dotted{border-bottom:1px dotted #cb4b16}.cm-s-solarized-light .CodeMirror-gutter{background-color:#eee8d5;border-right:3px solid #eee8d5}.cm-s-solarized-light .CodeMirror-gutter .CodeMirror-gutter-text{color:#93a1a1}.cm-s-solarized-light .CodeMirror-cursor{border-left-color:#002b36 !important}.cm-s-solarized-light .CodeMirror-matchingbracket{color:#002b36;background-color:#eee8d5;box-shadow:0 0 10px #eee8d5;font-weight:bold}.cm-s-solarized-light .CodeMirror-nonmatchingbracket{color:#002b36;background-color:#eee8d5;box-shadow:0 0 10px #eee8d5;font-weight:bold;color:#dc322f;border-bottom:1px dotted #cb4b16}.cm-s-solarized-light span.cm-keyword{color:#268bd2}.cm-s-solarized-light span.cm-atom{color:#2aa198}.cm-s-solarized-light span.cm-number{color:#586e75}.cm-s-solarized-light span.cm-def{color:#637c84}.cm-s-solarized-light span.cm-variable{color:#637c84}.cm-s-solarized-light span.cm-variable-2{color:#b58900}.cm-s-solarized-light span.cm-variable-3{color:#cb4b16}.cm-s-solarized-light span.cm-comment{color:#93a1a1}.cm-s-solarized-light span.cm-property{color:#637c84}.cm-s-solarized-light span.cm-operator{color:#657b83}.cm-s-solarized-light span.cm-string{color:#36958e}.cm-s-solarized-light span.cm-error{font-weight:bold;border-bottom:1px dotted #cb4b16}.cm-s-solarized-light span.cm-bracket{color:#cb4b16}.cm-s-solarized-light span.cm-tag{color:#657b83}.cm-s-solarized-light span.cm-attribute{color:#586e75;font-weight:bold}.cm-s-solarized-light span.cm-meta{color:#268bd2}.cm-s-solarized-dark{background-color:#002b36;color:#839496}.cm-s-solarized-dark .emphasis{font-weight:bold}.cm-s-solarized-dark .dotted{border-bottom:1px dotted #cb4b16}.cm-s-solarized-dark .CodeMirror-gutter{background-color:#073642;border-right:3px solid #073642}.cm-s-solarized-dark .CodeMirror-gutter .CodeMirror-gutter-text{color:#586e75}.cm-s-solarized-dark .CodeMirror-cursor{border-left-color:#fdf6e3 !important}.cm-s-solarized-dark .CodeMirror-matchingbracket{color:#fdf6e3;background-color:#073642;box-shadow:0 0 10px #073642;font-weight:bold}.cm-s-solarized-dark .CodeMirror-nonmatchingbracket{color:#fdf6e3;background-color:#073642;box-shadow:0 0 10px #073642;font-weight:bold;color:#dc322f;border-bottom:1px dotted #cb4b16}.cm-s-solarized-dark span.cm-keyword{color:#839496;font-weight:bold}.cm-s-solarized-dark span.cm-atom{color:#2aa198}.cm-s-solarized-dark span.cm-number{color:#93a1a1}.cm-s-solarized-dark span.cm-def{color:#268bd2}.cm-s-solarized-dark span.cm-variable{color:#cb4b16}.cm-s-solarized-dark span.cm-variable-2{color:#cb4b16}.cm-s-solarized-dark span.cm-variable-3{color:#cb4b16}.cm-s-solarized-dark span.cm-comment{color:#586e75}.cm-s-solarized-dark span.cm-property{color:#b58900}.cm-s-solarized-dark span.cm-operator{color:#839496}.cm-s-solarized-dark span.cm-string{color:#6c71c4}.cm-s-solarized-dark span.cm-error{font-weight:bold;border-bottom:1px dotted #cb4b16}.cm-s-solarized-dark span.cm-bracket{color:#cb4b16}.cm-s-solarized-dark span.cm-tag{color:#839496}.cm-s-solarized-dark span.cm-attribute{color:#93a1a1;font-weight:bold}.cm-s-solarized-dark span.cm-meta{color:#268bd2}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border:none;margin:0;padding:0}html{background:#f9f9f9}.left{float:left}.right{float:right}.container{padding-top:50px;min-width:960px}.wrap{width:960px;margin-left:auto;margin-right:auto;padding-left:20px;padding-right:20px}.skinnyWrap{width:690px;margin-left:auto;margin-right:auto;padding-left:20px;padding-right:20px}hr{height:0;border-top:1px solid #ccc;border-bottom:1px solid #eee}ul,li{margin-left:20px}.nav-main{*zoom:1;background:#222;color:#fafafa;position:fixed;top:0;height:50px;box-shadow:0 0 5px rgba(0,0,0,0.5);width:100%;z-index:100}.nav-main:before,.nav-main:after{content:" ";display:table}.nav-main:after{clear:both}.nav-main a{color:#e9e9e9;text-decoration:none}.nav-main .nav-site{float:right;margin:0}.nav-main .nav-site li{margin:0}.nav-main .nav-site a{padding:0 8px;text-transform:uppercase;letter-spacing:1px;line-height:50px;display:inline-block;height:50px;color:#aaa}.nav-main .nav-site a:hover{color:#fafafa}.nav-main .nav-site a.active{color:#fafafa;border-bottom:3px solid #cc7a6f;background:#333}.nav-main .nav-home{color:#00d8ff;font-size:24px;line-height:50px}.nav-main .nav-logo{background-image:url("../img/logo_small.png");vertical-align:middle}@media only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 1.3 / 1), only screen and (min-resolution: 125dpi), only screen and (min-resolution: 1.3dppx){.nav-main .nav-logo{background-image:url("../img/logo_small@2x.png");background-size:38px 38px}}.nav-main ul{display:inline}.nav-main li{display:inline}.hero{height:300px;background:#2d2d2d;padding-top:50px;color:#e9e9e9;font-weight:300}.hero .text{font-size:64px;text-align:center}.hero .minitext{font-size:16px;text-align:center;text-transform:uppercase}.hero strong{color:#61dafb;font-weight:400}.buttons-unit{margin-top:60px;text-align:center}.buttons-unit a{color:#61dafb}.buttons-unit .button{font-size:24px;background:#cc7a6f;color:#fafafa}.buttons-unit .button:active{background:#c5695c}.buttons-unit.downloads{margin:30px 0}.nav-docs{color:#2d2d2d;font-size:14px;float:left;top:100px;width:180px}.nav-docs ul{list-style:none;margin:0}.nav-docs li{margin:0}.nav-docs h3{text-transform:uppercase;font-size:14px}.nav-docs a{color:#666;display:block}.nav-docs a:hover{text-decoration:none;color:#cc7a6f}.nav-docs a.active{color:#cc7a6f}.nav-docs .nav-docs-section{border-bottom:1px solid #ccc;border-top:1px solid #eee;padding:12px 0}.nav-docs .nav-docs-section:first-child{padding-top:0;border-top:0}.nav-docs .nav-docs-section:last-child{padding-bottom:0;border-bottom:0}.home-section{margin:50px 0}.home-divider{border-top-color:#bbb;margin:0 auto;width:400px}.marketing-row{*zoom:1;margin:50px 0}.marketing-row:before,.marketing-row:after{content:" ";display:table}.marketing-row:after{clear:both}.marketing-col{float:left;margin-right:40px;width:280px}.marketing-col h3{color:#2d2d2d;font-size:24px;font-weight:normal;text-transform:uppercase}.marketing-col p{font-size:16px}.marketing-col:last-child{margin-right:0}#examples h3{color:#2d2d2d;font-size:24px;font-weight:normal;margin-bottom:5px}#examples p{margin:0 0 25px 0;max-width:600px}#examples .example{margin-top:60px}#examples #todoExample{font-size:14px}#examples #todoExample ul{list-style-type:square;margin:0 0 10px 0}#examples #todoExample input{border:1px solid #ccc;font:14px proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;padding:3px;width:150px}#examples #todoExample button{font:14px proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;margin-left:5px;padding:4px 10px}#examples #markdownExample textarea{border:1px solid #ccc;font:14px proxima-nova,"Helvetica Neue",Helvetica,Arial,sans-serif;margin-bottom:10px;padding:5px}.home-bottom-section{margin-bottom:100px}.docs-nextprev{*zoom:1}.docs-nextprev:before,.docs-nextprev:after{content:" ";display:table}.docs-nextprev:after{clear:both}.docs-prev{float:left}.docs-next{float:right}footer{font-size:13px;font-weight:600;margin-top:36px;margin-bottom:18px;overflow:auto}section.black content{padding-bottom:18px}.documentationContent{*zoom:1;padding-top:20px}.documentationContent:before,.documentationContent:after{content:" ";display:table}.documentationContent:after{clear:both}.documentationContent .subHeader{font-size:24px}.documentationContent h2{margin-top:30px}.documentationContent blockquote{padding:15px 30px 15px 15px;margin:20px 0;background-color:rgba(204,122,111,0.1);border-left:5px solid rgba(191,87,73,0.2)}.documentationContent blockquote h4{margin-top:0}.documentationContent blockquote p:last-child{margin-bottom:0}.documentationContent blockquote p:first-child{font-weight:bold;font-size:17.5px;line-height:20px;margin-top:0;text-rendering:optimizelegibility}.docs-prevnext{padding-top:40px;padding-bottom:40px}.jsxCompiler{margin:0 auto;padding-top:20px;width:1220px}.jsxCompiler #jsxCompiler{margin-top:20px}.jsxCompiler .playgroundPreview{padding:14px;width:600px}.jsxCompiler .playgroundPreview pre{font-family:'source-code-pro', Menlo, 'Courier New', Consolas, monospace;font-size:13px;line-height:20px}.button{background:-webkit-linear-gradient( #9a9a9a,#646464);background:linear-gradient( #9a9a9a,#646464);border-radius:4px;padding:8px 16px;font-size:18px;font-weight:400;margin:0 12px;display:inline-block;color:#fafafa;text-decoration:none;text-shadow:0 1px 3px rgba(0,0,0,0.3);box-shadow:0 1px 1px rgba(0,0,0,0.2);text-decoration:none}.button:hover{text-decoration:none}.button:active{box-shadow:none}.hero .button{box-shadow:1px 3px 3px rgba(0,0,0,0.3)}.button.blue{background:-webkit-linear-gradient( #77a3d2,#4783c2);background:linear-gradient( #77a3d2,#4783c2)}.row{padding-bottom:4px}.row .span4{width:33.33%;display:table-cell}.row .span8{width:66.66%;display:table-cell}.row .span6{width:50%;display:table-cell}p{margin:10px 0}.highlight{padding:10px;margin-bottom:20px}.inner-content{float:right;width:650px}.nosidebar .inner-content{float:none;margin:0 auto}.post-list-item+.post-list-item{margin-top:60px}div.CodeMirror pre,div.CodeMirror-linenumber,code{font-family:'source-code-pro', Menlo, 'Courier New', Consolas, monospace;font-size:13px;line-height:20px}div.CodeMirror-linenumber:after{content:'.'}.CodeMirror,div.CodeMirror-gutters,div.highlight{border:none}small code,li code,p code{color:#555;background-color:rgba(0,0,0,0.04);padding:1px 3px}.cm-s-default span.cm-string-2{color:inherit}.playground{*zoom:1}.playground:before,.playground:after{content:" ";display:table}.playground:after{clear:both}.playground::before{border-bottom:none !important;border-radius:3px 3px 0 0;padding:3px 7px;font-size:12px;font-weight:bold;color:#c2c0bc;background-color:#f1ede4;content:'Live editor'}.playground::before,.playgroundCode,.playgroundPreview{border:1px solid rgba(16,16,16,0.1)}.playgroundCode{border-radius:0 3px 3px 3px;float:left;overflow:hidden;width:600px}.playgroundPreview{background-color:white;border-radius:3px;float:right;padding:15px 20px;width:280px}.MarkdownEditor textarea{width:100%;height:100px}.hll{background-color:#f7ebc6;border-left:5px solid #f7d87c;display:block;margin-left:-14px;margin-right:-14px;padding-left:9px}.highlight .javascript .err{background-color:transparent;color:inherit}.highlight{position:relative;margin-bottom:14px;padding:30px 14px 14px;border:none;border-radius:0;overflow:auto}.highlight pre{padding:0;margin-top:0;margin-bottom:0;background-color:transparent;border:0}.highlight pre code{font-size:inherit}.highlight pre .lineno{display:inline-block;width:22px;padding-right:5px;margin-right:10px;color:#bebec5;text-align:right}.highlight:after{position:absolute;top:0;right:0;left:0;padding:3px 7px;font-size:12px;font-weight:bold;color:#c2c0bc;background-color:#f1ede4;content:"Code"}.downloadCenter{text-align:center;margin-top:20px;margin-bottom:25px}.downloadSection:hover{text-decoration:none !important}@media screen and (max-width: 960px){.nav-main{position:static}.container{padding-top:0}} diff --git a/docs/advanced-components.html b/docs/advanced-components.html index ecf49b79bd..80e3302d5b 100644 --- a/docs/advanced-components.html +++ b/docs/advanced-components.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/api.html b/docs/api.html index 612df177b2..5fd8cf9184 100644 --- a/docs/api.html +++ b/docs/api.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/common-questions.html b/docs/common-questions.html index 851c94a92e..d12dea4f5c 100644 --- a/docs/common-questions.html +++ b/docs/common-questions.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/component-basics.html b/docs/component-basics.html index 5391b268d6..a023843a57 100644 --- a/docs/component-basics.html +++ b/docs/component-basics.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/component-data.html b/docs/component-data.html index 2978c31ecb..7e0fd6b4c5 100644 --- a/docs/component-data.html +++ b/docs/component-data.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/component-lifecycle.html b/docs/component-lifecycle.html index 29191baa91..7ab7f92976 100644 --- a/docs/component-lifecycle.html +++ b/docs/component-lifecycle.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/event-handling.html b/docs/event-handling.html index 6ee4c8ce50..b264addb86 100644 --- a/docs/event-handling.html +++ b/docs/event-handling.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/getting-started.html b/docs/getting-started.html index 1d558c648e..cd828145fc 100644 --- a/docs/getting-started.html +++ b/docs/getting-started.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github @@ -79,7 +81,18 @@

    Getting Started

    -

    Download the starter kit to get started.

    +

    JSFiddle

    + +

    The easiest way to start hacking on React is using the following JSFiddle Hello Worlds

    + + + +

    Starter Kit

    + +

    Download the starter kit to get started.

    -

    Hello, world!

    -

    In the root directory of the starter kit, create a helloworld.html with the following contents.

    <!DOCTYPE html>
     <html>
    diff --git a/docs/mixins.html b/docs/mixins.html
    index 1a2992cf33..e0671475e6 100644
    --- a/docs/mixins.html
    +++ b/docs/mixins.html
    @@ -12,6 +12,7 @@
       
     
       
    +  
     
       
       
    @@ -41,6 +42,7 @@
               
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/syntax.html b/docs/syntax.html index 90184600f2..2bf53c28db 100644 --- a/docs/syntax.html +++ b/docs/syntax.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/docs/tutorial.html b/docs/tutorial.html index 1eed3b6fd3..ccad91cc9f 100644 --- a/docs/tutorial.html +++ b/docs/tutorial.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github @@ -155,7 +157,7 @@ var CommentBox = React.createClass({ render: function() { return ( - ReactDOM.div({ + React.DOM.div({ className: 'commentBox', children: 'Hello, world! I am a CommentBox.' }) @@ -217,7 +219,7 @@ } });
  • -

    Notice how we're mixing HTML tags and components we've built. HTML components are regular React components, just like the ones you define, with one difference. The JSX compiler will automatically rewrite HTML tags to "ReactDOM.tagName" expressions and leave everything else alone. This is to prevent the pollution of the global namespace.

    +

    Notice how we're mixing HTML tags and components we've built. HTML components are regular React components, just like the ones you define, with one difference. The JSX compiler will automatically rewrite HTML tags to "React.DOM.tagName" expressions and leave everything else alone. This is to prevent the pollution of the global namespace.

    Component Properties

    @@ -374,8 +376,8 @@ return ( <div class="commentBox"> <h1>Comments</h1> - <CommentList data={this.state.data} /> - <CommentForm /> + <CommentList data={this.state.data} /> + <CommentForm /> </div> ); } diff --git a/downloads.html b/downloads.html index f460423e5c..64b15f2404 100644 --- a/downloads.html +++ b/downloads.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github @@ -67,15 +69,18 @@

    React Core 0.3.2 (production)

    The compressed, production version of React core

    - +
    <script src="http://fb.me/react-0.3.2.min.js"></script>
    +

    React Core 0.3.2 (development)

    The uncompressed, development version of React core with inline documentation.

    - +
    <script src="http://fb.me/react-0.3.2.js"></script>
    +

    JSX Transform

    The JSX transformer used to support XML syntax in JavaScript.

    - +
    <script src="http://fb.me/JSXTransformer-0.3.2.js"></script>
    +

    Bower

    $ bower install --save react
     
    diff --git a/feed.xml b/feed.xml new file mode 100644 index 0000000000..cf95e16056 --- /dev/null +++ b/feed.xml @@ -0,0 +1,122 @@ + + + + React + A JavaScript library for building user interfaces + http://facebook.github.io/react + + + + Why did we build React? + <p>There are a lot of JavaScript MVC frameworks out there. Why did we build React +and why would you want to use it?</p> + +<h2>React isn&#39;t an MVC framework.</h2> + +<p>React is a library for building composable user interfaces. It encourages +the creation of reusable UI components which present data that changes over +time.</p> + +<h2>React doesn&#39;t use templates.</h2> + +<p>Traditionally, web application UIs are built using templates or HTML directives. +These templates dictate the full set of abstractions that you are allowed to use +to build your UI.</p> + +<p>React approaches building user interfaces differently by breaking them into +<strong>components</strong>. This means React uses JavaScript to generate markup, which we +see as an advantage over templates for a few reasons:</p> + +<ul> +<li><strong>JavaScript is a flexible, powerful programming language</strong> with the ability +to build abstractions. This is incredibly important in large applications.</li> +<li>By unifying your markup with it&#39;s corresponding view logic, React can actually +make views <strong>easier to extend and maintain</strong>.</li> +<li>By baking an understanding of markup and content into JavaScript, there&#39;s +<strong>no manual string concatenation</strong> and therefore less surface area for XSS +vulnerabilities.</li> +</ul> + +<p>We&#39;ve also created <a href="facebook.github.io/react/docs/syntax.html">JSX</a>, an optional +syntax extension, in case you prefer the readability of HTML to raw JavaScript.</p> + +<h2>Reactive updates are dead simple.</h2> + +<p>React really shines when your data changes over time.</p> + +<p>In a traditional JavaScript application, you need to look at what data changed +and imperatively make changes to the DOM to keep it up-to-date. Even AngularJS, +which provides a declarative interface via directives and data binding <a href="http://docs.angularjs.org/guide/directive#reasonsbehindthecompilelinkseparation">requires +a linking function to manually update DOM nodes</a>.</p> + +<p>React takes a different approach.</p> + +<p>When your component is first initialized, the <code>render</code> method is called, +generating a lightweight representation of your view. From that representation, +a string of markup is produced, and injected into the document. When your data +changes, the <code>render</code> method is called again. In order to perform updates as +efficiently as possible, we diff the return value from the previous call to +<code>render</code> with the new one, and generate a minimal set of changes to be applied +to the DOM.</p> + +<blockquote> +<p>The data returned from <code>render</code> is neither a string nor a DOM node -- it&#39;s a +lightweight description of what the DOM should look like.</p> +</blockquote> + +<p>We call this process <strong>reconciliation</strong>. Check out +<a href="http://jsfiddle.net/fv6RD/3/">this jsFiddle</a> to see an example of +reconciliation in action.</p> + +<p>Because this re-render is so fast (around 1ms for TodoMVC), the developer +doesn&#39;t need to explicitly specify data bindings. We&#39;ve found this approach +makes it easier to build apps.</p> + +<h2>HTML is just the beginning.</h2> + +<p>Because React has its own lightweight representation of the document, we can do +some pretty cool things with it:</p> + +<ul> +<li>Facebook has dynamic charts that render to <code>&lt;canvas&gt;</code> instead of HTML.</li> +<li>Instagram is a &quot;single page&quot; web app built entirely with React and +<code>Backbone.Router</code>. Designers regularly contribute React code with JSX.</li> +<li>We&#39;ve built internal prototypes that run React apps in a web worker and use +React to drive <strong>native iOS views</strong> via an Objective-C bridge.</li> +<li>You can run React +<a href="http://github.com/petehunt/react-server-rendering">on the server</a> +for SEO, performance, code sharing and overall flexibility.</li> +<li>Events behave in a consistent, standards-compliant way in all browsers +(including IE8) and automatically use +<a href="http://davidwalsh.name/event-delegate">event delegation</a>.</li> +</ul> + +<p>Head on over to +<a href="http://facebook.github.io/react">facebook.github.io/react</a> to check +out what we have built. Our documentation is geared towards building +apps with the framework, but if you are interested in the +nuts and bolts +<a href="http://facebook.github.io/react/support.html">get in touch</a> with us!</p> + +<p>Thanks for reading!</p> + + 2013-06-05T00:00:00-07:00 + http://facebook.github.io/react/blog/2013/06/05/why-react.html + http://facebook.github.io/react/blog/2013/06/05/why-react.html + + + + JSFiddle Integration + <p><a href="http://jsfiddle.net">JSFiddle</a> just announced support for React. This is an exciting news as it makes collaboration on snippets of code a lot easier. You can play around this <strong><a href="http://jsfiddle.net/vjeux/kb3gN/">base React JSFiddle</a></strong>, fork it and share it! A <a href="http://jsfiddle.net/vjeux/VkebS/">fiddle without JSX</a> is also available.</p> + +<blockquote class="twitter-tweet" align="center"><p>React (by Facebook) is now available on JSFiddle. <a href="http://t.co/wNQf9JPv5u" title="http://facebook.github.io/react/">facebook.github.io/react/</a></p>&mdash; JSFiddle (@jsfiddle) <a href="https://twitter.com/jsfiddle/status/341114115781177344">June 2, 2013</a></blockquote> + +<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> + + 2013-06-02T00:00:00-07:00 + http://facebook.github.io/react/blog/2013/06/02/jsfiddle-integration.html + http://facebook.github.io/react/blog/2013/06/02/jsfiddle-integration.html + + + + diff --git a/index.html b/index.html index 389547a16f..176aabcd71 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/js/examples/todo.js b/js/examples/todo.js index 8cfe0b9cd3..1089577f9d 100644 --- a/js/examples/todo.js +++ b/js/examples/todo.js @@ -14,15 +14,15 @@ var TodoList = React.createClass({\n\ });\n\ \n\ var TodoCreate = React.createClass({\n\ - handleSubmit: function() {\n\ + handleSubmit: React.autoBind(function() {\n\ var textInput = this.refs.textInput.getDOMNode();\n\ this.props.onCreate(textInput.value);\n\ textInput.value = '';\n\ return false;\n\ - },\n\ + }),\n\ render: function() {\n\ return (\n\ -
    \n\ + \n\ \n\ \n\
    \n\ @@ -34,15 +34,15 @@ var TodoApp = React.createClass({\n\ getInitialState: function() {\n\ return {items: []};\n\ },\n\ - onItemCreate: function(value) {\n\ + onItemCreate: React.autoBind(function(value) {\n\ this.setState({items: this.state.items.concat([value])});\n\ - },\n\ + }),\n\ render: function() {\n\ return (\n\
    \n\

    TODO

    \n\ \n\ - \n\ + \n\
    \n\ );\n\ }\n\ diff --git a/js/live_editor.js b/js/live_editor.js index 10a9cdc116..34421d4e27 100644 --- a/js/live_editor.js +++ b/js/live_editor.js @@ -81,7 +81,7 @@ var ReactPlayground = React.createClass({displayName: 'ReactPlayground', ); } else if (this.state.mode === this.MODES.JS) { content = - React.DOM.div( {className:{playgroundJS: true, playgroundStage: true}}, + React.DOM.div( {className:"playgroundJS playgroundStage"}, this.getDesugaredCode() ); } @@ -121,7 +121,7 @@ var ReactPlayground = React.createClass({displayName: 'ReactPlayground', } } catch (e) { React.renderComponent( - React.DOM.div( {content:e.toString(), className:{playgroundError: true}}, null ), + React.DOM.div( {content:e.toString(), className:"playgroundError"}, null ), mountNode ); } diff --git a/jsx-compiler.html b/jsx-compiler.html index 9d9ca89b5f..05455c6b74 100644 --- a/jsx-compiler.html +++ b/jsx-compiler.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github diff --git a/support.html b/support.html index e549a49ac1..6f900fc492 100644 --- a/support.html +++ b/support.html @@ -12,6 +12,7 @@ + @@ -41,6 +42,7 @@
  • docs
  • support
  • download
  • +
  • blog
  • github