committed by
Connor McSheffrey
2 changed files with 27 additions and 0 deletions
@ -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/>`. |
@ -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…
Reference in new issue