@samitouri / QOS-React-2 / commits / 7144ba1c10

new entry on self-closing tag

Cheng Lou committed Sep 27, 2013 at 02:32 UTC 7144ba1c104e18958728b57ac2319b618e734a6d
2 files changed +27
docs/cookbook/cb-04-self-closing-tag tip.md new
+11
@@ -0,0 +1,11 @@
1 +---
2 +id: self-closing-tag
3 +title: Self-Closing Tag
4 +layout: docs
5 +permalink: inline-styles.html
6 +script: "cookbook/inline-styles.js"
7 +---
8 +
9 +In JSX, `<MyComponent />` alone is valid while `<MyComponent>` isn't.
10 +
11 +Related: every React component can be self-closing where it makes sense: `<div/>`.
docs/cookbook/cb-04-self-closing-tag.md new
+16
@@ -0,0 +1,16 @@
1 +---
2 +id: self-closing-tag
3 +title: Self-Closing Tag
4 +layout: docs
5 +permalink: inline-styles.html
6 +script: "cookbook/inline-styles.js"
7 +---
8 +
9 +### Problem
10 +You're getting a parsing error (unexpected token) from JSX.
11 +
12 +### Solution
13 +One of the reasons might be that you didn't put a `/` for your self-closing tags. `<MyComponent />` is valid while `<MyComponent>` isn't.
14 +
15 +### Discussion
16 +Every React component can be self-closing where it makes sense: `<div/>`.