mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 04:33:10 +00:00
entry on returning only one node from render
This commit is contained in:
committed by
Connor McSheffrey
parent
6a04b5aefd
commit
9558b42b1c
10
cookbook/cb-05-jsx-root-node-count tip.md
Normal file
10
cookbook/cb-05-jsx-root-node-count tip.md
Normal file
@@ -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
Normal file
15
cookbook/cb-05-jsx-root-node-count.md
Normal file
@@ -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.
|
||||
Reference in New Issue
Block a user