@samitouri / QOS-React-2 / commits / 814126dc52

entry on returning only one node from `render`

Cheng Lou committed Sep 27, 2013 at 23:29 UTC 814126dc52917dfe632e33175ca6c47ff3b53320
2 files changed +25
docs/cookbook/cb-05-jsx-root-node-count tip.md new
+10
@@ -0,0 +1,10 @@
1 +---
2 +id: jsx-root-node-count-tip
3 +title: Maximum number of JSX root nodes
4 +layout: docs
5 +permalink: jsx-root-node-count-tip.html
6 +---
7 +
8 +Currently in `render`, you can only return one node; if you have, say, a list of divs to return, you must wrap your components within, say, one big `div` or `span` (or any other component).
9 +
10 +Don't forget that JSX compiles into regular js, and returning two functions doesn't really make syntactic sense.
docs/cookbook/cb-05-jsx-root-node-count.md new
+15
@@ -0,0 +1,15 @@
1 +---
2 +id: jsx-root-node-count
3 +title: Maximum number of JSX root nodes
4 +layout: docs
5 +permalink: jsx-root-node-count.html
6 +---
7 +
8 +### Problem
9 +You're getting a parsing error from JSX.
10 +
11 +### Solution
12 +You might have tried to return more than one node from JSX in `render`. Currently, you can only return one node; meaning that you must wrap your components within, say, a `div` or a `span` (or any other component).
13 +
14 +### Discussion
15 +Don't forget that JSX compiles into regular js, and returning two functions doesn't really make syntactic sense.