Browse Source

entry on returning only one node from `render`

main
Cheng Lou 11 years ago
committed by Connor McSheffrey
parent
commit
9558b42b1c
  1. 10
      cookbook/cb-05-jsx-root-node-count tip.md
  2. 15
      cookbook/cb-05-jsx-root-node-count.md

10
cookbook/cb-05-jsx-root-node-count tip.md

@ -0,0 +1,10 @@
---
id: jsx-root-node-count-tip
title: Maximum number of JSX root nodes
layout: docs
permalink: jsx-root-node-count-tip.html
---
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).
Don't forget that JSX compiles into regular js, and returning two functions doesn't really make syntactic sense.

15
cookbook/cb-05-jsx-root-node-count.md

@ -0,0 +1,15 @@
---
id: jsx-root-node-count
title: Maximum number of JSX root nodes
layout: docs
permalink: jsx-root-node-count.html
---
### Problem
You're getting a parsing error from JSX.
### Solution
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).
### Discussion
Don't forget that JSX compiles into regular js, and returning two functions doesn't really make syntactic sense.
Loading…
Cancel
Save