Skip to content

Commit 9824d52

Browse files
Radi123gaearon
authored andcommitted
React.createElement syntax (facebook#9459)
* React.createElement syntax Added React.createElement syntax. I think this is required for this tutorial. * Reword
1 parent d6cc1d1 commit 9824d52

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: docs/tutorial/tutorial.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ The `render` method returns a *description* of what you want to render, and then
9393

9494
```javascript
9595
return React.createElement('div', {className: 'shopping-list'},
96-
React.createElement('h1', ...),
97-
React.createElement('ul', ...)
96+
React.createElement('h1', /* ... h1 children ... */),
97+
React.createElement('ul', /* ... ul children ... */)
9898
);
9999
```
100100

101+
If you're curious, `createElement()` is described in more detail in the [API reference](/react/docs/react-api.html#createelement), but we won't be using it directly in this tutorial. Instead, we will keep using JSX.
102+
101103
You can put any JavaScript expression within braces inside JSX. Each React element is a real JavaScript object that you can store in a variable or pass around your program.
102104

103105
The `ShoppingList` component only renders built-in DOM components, but you can compose custom React components just as easily, by writing `<ShoppingList />`. Each component is encapsulated so it can operate independently, which allows you to build complex UIs out of simple components.

0 commit comments

Comments
 (0)