new entry on self-closing tag

This commit is contained in:
Cheng Lou
2013-09-27 02:32:59 -04:00
committed by Connor McSheffrey
parent aa38740189
commit 9ccee7f475
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
---
id: self-closing-tag
title: Self-Closing Tag
layout: docs
permalink: inline-styles.html
script: "cookbook/inline-styles.js"
---
In JSX, `<MyComponent />` alone is valid while `<MyComponent>` isn't.
Related: every React component can be self-closing where it makes sense: `<div/>`.

View File

@@ -0,0 +1,16 @@
---
id: self-closing-tag
title: Self-Closing Tag
layout: docs
permalink: inline-styles.html
script: "cookbook/inline-styles.js"
---
### Problem
You're getting a parsing error (unexpected token) from JSX.
### Solution
One of the reasons might be that you didn't put a `/` for your self-closing tags. `<MyComponent />` is valid while `<MyComponent>` isn't.
### Discussion
Every React component can be self-closing where it makes sense: `<div/>`.