From f6f2c2be13f7905275f31f6a53119a93182bf531 Mon Sep 17 00:00:00 2001 From: Melissa Date: Fri, 12 Oct 2018 18:41:40 -0500 Subject: [PATCH] Add 'tags must be closed' rule to JSX guide (#18581) --- .../pages/guide/english/react/jsx/index.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/client/src/pages/guide/english/react/jsx/index.md b/client/src/pages/guide/english/react/jsx/index.md index 4bb07a964d..065b107420 100644 --- a/client/src/pages/guide/english/react/jsx/index.md +++ b/client/src/pages/guide/english/react/jsx/index.md @@ -71,6 +71,37 @@ const tags = ( ); ``` +### All Tags Must Be Closed + +In HTML, there are self-closing tags such as `img`, `br`, `input`, and `hr`. + +This means that either of these methods are valid: + +```html + + + + +``` + +Self-closing (sometimes referred to as **void**) tags can be rendered with or without a closing forward slash. + +However, with JSX, _all_ tags must be closed. + +The following JSX is invalid: + +```javascript +const email = ; +``` + +Closing the `input` tag will make the JSX valid: + + +```javascript +const email = ; +``` + + ### More Information - [Introducing JSX](https://reactjs.org/docs/introducing-jsx.html)