Skip to content

Commit 36b61d2

Browse files
committed
Merge pull request #14 from petehunt/marketing
Docs updates per community response
2 parents 84a7c2e + 2ce4530 commit 36b61d2

File tree

4 files changed

+34
-14
lines changed

4 files changed

+34
-14
lines changed

docs/_js/examples/timer.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
var TIMER_COMPONENT = "\
6-
/** @jsx React.DOM */\n\
76
var Timer = React.createClass({\n\
87
getInitialState: function() {\n\
98
return {secondsElapsed: 0};\n\
@@ -15,15 +14,13 @@ var Timer = React.createClass({\n\
1514
setInterval(this.tick, 1000);\n\
1615
},\n\
1716
render: function() {\n\
18-
return (\n\
19-
<div>\n\
20-
{'Seconds Elapsed: ' + this.state.secondsElapsed}\n\
21-
</div>\n\
17+
return React.DOM.div({},\n\
18+
'Seconds Elapsed: ' + this.state.secondsElapsed\n\
2219
);\n\
2320
}\n\
2421
});\n\
2522
\n\
26-
React.renderComponent(<Timer />, mountNode);\
23+
React.renderComponent(Timer({}), mountNode);\
2724
";
2825

2926
React.renderComponent(

docs/docs/common-questions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ layout: docs
55
prev: tutorial.html
66
next: syntax.html
77
---
8+
89
### What browsers does React support?
910

1011
React supports the latest two Chrome, Firefox, Safari, and Internet Explorer versions. React can work with Internet Explorer 8 with polyfills.
@@ -17,6 +18,11 @@ React requires ES5 JavaScript shims to run in Internet Explorer 8. Include the [
1718

1819
The [Instagram](http://instagram.com/) website is built entirely in React. The [Facebook](https://www.facebook.com/) website is also increasingly using React, including the common commenting plugin across the site.
1920

21+
### I don't get it. React is confusing!
22+
23+
[This blog post by a member of the React team](http://www.quora.com/Pete-Hunt/Posts/React-Under-the-Hood) talks about some of the reasons
24+
why React is designed the way that it is.
25+
2026
### Can I integrate with other JavaScript libraries?
2127

2228
Absolutely! In fact, we encourage it! See [our GitHub repo](http://github.com/facebook/react/) for a [TodoMVC example using Backbone](https://github.com/facebook/react/tree/master/examples/todomvc-backbone) and a [jQuery + Bootstrap modal demo](https://github.com/facebook/react/tree/master/examples/jquery-bootstrap).

docs/docs/syntax.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ with React.
1313
JSX makes code that deeply nests React components more readable, and writing it
1414
feels like writing HTML. React documentation examples make use of JSX.
1515

16+
## Why JSX?
17+
18+
First of all, **don't use JSX if you don't like it!** All of React's features
19+
work just fine without using JSX. Simply construct your markup using the functions
20+
on `React.DOM`. For example, here's how to construct a simple link:
21+
22+
```javascript
23+
var mylink = React.DOM.a({href: 'http://facebook.github.io/react'}, 'Hello React');
24+
```
25+
26+
However, we like JSX for a bunch of reasons:
27+
28+
- It's easier to visualize the structure of the DOM
29+
- Designers are more comfortable making changes
30+
- It's familiar for those who have used MXML or XAML
31+
1632
## The Transform
1733

1834
JSX transforms XML-like syntax into native JavaScript. It turns XML elements and

docs/index.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ id: home
66
<section class="light home-section">
77
<div class="marketing-row">
88
<div class="marketing-col">
9-
<h3>Declarative</h3>
9+
<h3>The &quot;V&quot; in MVC</h3>
1010
<p>
11-
React uses a declarative paradigm that makes it easier to reason about
12-
your application.
11+
Write reusable UI components in JavaScript. Read and write to any data source.
1312
</p>
1413
</div>
1514
<div class="marketing-col">
16-
<h3>Efficient</h3>
15+
<h3>Fast &amp; Declarative</h3>
1716
<p>
18-
React minimizes interactions with the DOM by using a mock representation
19-
of the DOM.
17+
Describe how you want your component to look. React will automatically compute
18+
the fastest way to keep the UI up-to-date when the data changes.
2019
</p>
2120
</div>
2221
<div class="marketing-col">
@@ -35,7 +34,8 @@ id: home
3534
<p>
3635
React components implement a `render()` method that takes input data and
3736
returns what to display. This example constructs the component using an
38-
XML-like syntax called JSX. Input data is passed to the component as XML
37+
XML-like syntax called JSX, but <strong>JSX is optional; you don&apos;t
38+
need to use it</strong>. Input data is passed to the component as XML
3939
attributes, and `render()` accesses this data via `this.props`.
4040
</p>
4141
<div id="helloExample"></div>
@@ -46,7 +46,8 @@ id: home
4646
In addition to taking data from its creator (accessed via `this.props`),
4747
a component can maintain internal state data (accessed via
4848
`this.state`). When a component's state data changes, the rendered
49-
markup will be updated by re-invoking `render()`.
49+
markup will be updated by re-invoking `render()`. <strong>This example
50+
doesn&apos;t use JSX</strong>, but you could if you wanted to.
5051
</p>
5152
<div id="timerExample"></div>
5253
</div>

0 commit comments

Comments
 (0)