Browse Source

new entry on self-closing tag

main
Cheng Lou 12 years ago
committed by Connor McSheffrey
parent
commit
9ccee7f475
  1. 11
      cookbook/cb-04-self-closing-tag tip.md
  2. 16
      cookbook/cb-04-self-closing-tag.md

11
cookbook/cb-04-self-closing-tag tip.md

@ -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/>`.

16
cookbook/cb-04-self-closing-tag.md

@ -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/>`.
Loading…
Cancel
Save