Skip to content

Commit 8e9c161

Browse files
committed
fix broken jsx
1 parent c34397b commit 8e9c161

File tree

5 files changed

+20
-30
lines changed

5 files changed

+20
-30
lines changed

old pages/concepts/understanding-jsx.mdx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ This provides a concise and readable way to create and represent components.
1111

1212
Solid was designed to align closely with HTML standards.
1313

14-
```jsx
14+
```tsx
1515
const element = <h1>I'm JSX!!</h1>
1616
```
1717

1818
It offers a distinct advantage, however: to copy/paste solutions from resources like Stack Overflow; and to allow direct usage of templates from design tools.
1919
Solid sets itself apart by using JSX immediately as it returns [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction) elements.
2020
This lets you use dynamic expressions within your HTML by allowing variables and functions to be references with the use of curly braces (`{ }`):
2121

22-
```jsx
22+
```tsx
2323
const Component = () => {
2424
const animal = { breed: "cat", name: "Midnight" }
2525

@@ -42,7 +42,7 @@ This updates only the necessary parts of the DOM when changes occur in the under
4242

4343
Where HTML lets you have disconnected tags at the top level, JSX requires that a component to return a single root element.
4444

45-
:::advanced
45+
:::note
4646
When working with JSX, parts of your code are translated into structured HTML that is placed at the start of the file.
4747
Static elements are processed differently from dynamic ones, which might change based on data or user actions.
4848
For dynamic elements, special markers are added for better handling during rendering.
@@ -59,7 +59,7 @@ Self-closing tags are a must in JSX.
5959
Unlike in HTML, where elements like `<input>`, `<img>`, or `<br>` don't require explicit closure, JSX requires consistent self-closing tags.
6060
This helps to avoid potential rendering issues.
6161

62-
```jsx
62+
```tsx
6363
<img src="./image-here.png" />
6464
```
6565

@@ -81,23 +81,25 @@ In JSX files, HTML attributes are used much like regular HTML, with a few key di
8181
(**Note:** When using ESLint, you will get a warning if you use lowercase.)
8282
- In cases where you can dynamically specify a value, you can replace the `"` and `"` with curly braces (`{ }`):
8383

84-
```jsx
84+
```tsx
8585
<button class="myClass" onClick={handleClick}>
8686
Click me!
8787
</button>
8888
```
8989

90-
:::note
91-
If you wish to pass objects in JSX, such as with inline styling, you will have to use double curly braces (`{{ }}`).
90+
:::note
91+
92+
If you wish to pass objects in JSX, such as with inline styling, you will have to use double curly braces (`{{ }}`).
9293

93-
```jsx
94+
```tsx
9495
<button style={{
9596
color: 'red',
9697
font-size: '2rem',
9798
}}>
9899
Click me!
99100
</button>
100101
```
102+
101103
:::
102104

103105
### JSX properties (props)
@@ -120,10 +122,12 @@ They connect the component with the data it requires, for seamless data flows an
120122
This results in components that react in real-time to data changes.
121123

122124
:::note
125+
123126
Expressions, whether fixed or dynamic, get applied *in the order defined within the JSX*.
124127
This works for a wide range of DOM elements, but will not work with elements that require attributes to be defined in a special order, such as input types with `type='range'`.
125128

126129
When order influences an element's behavior, users must define the expressions in the order that the element is expected.
130+
127131
:::
128132

129133
For how to use props effectively in Solid, explore the [props page](/concepts/components/props).

src/routes/getting-started/counter.mdx

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/routes/getting-started/understanding-jsx.mdx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const component = () => {
3535

3636
## Solid's JSX Rules
3737

38-
### 1. Return a Single Root Element
38+
### Return a Single Root Element
3939

4040
Each component must return a single root element.
4141
Since JSX maintains the familiar tree-like structure of HTML, having a single root element helps keep the hierarchy clear.
@@ -52,14 +52,13 @@ function App() {
5252
}
5353
```
5454

55-
```advanced
55+
:::note
5656
JSX in Solid compiles into structured HTML.
5757
Static elements are optimized once, while dynamic ones get special markers so Solid can update them efficiently.
5858
Requiring a single root element keeps the hierarchy consistent and easier to update.
59-
```
60-
59+
:::
6160

62-
### 2. Close All Tags
61+
### Close All Tags
6362

6463
All tags must be properly closed.
6564
This includes self-closing tags like `<img />`, `<input />`, and `<br />`.
@@ -72,7 +71,7 @@ This includes self-closing tags like `<img />`, `<input />`, and `<br />`.
7271
<img src="image.jpg" alt="Description">
7372
```
7473

75-
### 3. Properties vs Attributes
74+
### Properties vs Attributes
7675

7776
In Solid's JSX, you can use both HTML attributes and JSX properties (props) to define element behavior and appearance.
7877

src/routes/reactivity/basics.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This makes applications efficient and responsive, even as they grow.
1515
Solid’s reactivity is built on three key ideas: **signals, subscribers, and tracking scopes**.
1616
Together, these create a system where updates are precise, automatic, and efficient.
1717

18-
### Signals: Reactive values
18+
### Signals
1919

2020
A **signal** is a reactive value container.
2121
They consist of 2 parts:
@@ -38,7 +38,7 @@ Signals can hold any type of value:
3838

3939
Learn more in the [Signals page](/reactivity/signals).
4040

41-
### Subscribers: Reactive consumers
41+
### Subscribers
4242

4343
If signals are the **source of truth**, subscribers are the **reactive consumers**.
4444

@@ -51,7 +51,7 @@ How subscribers work:
5151
2. **Dependency tracking** → those signals register the subscriber.
5252
3. **Response** → when a signal changes, the subscriber re-runs.
5353

54-
### Tracking Scopes: Connecting signals & subscribers
54+
### Tracking Scopes
5555

5656
A **tracking scope** is the environment where Solid records which signals are being used.
5757
When a signal is read within a tracking scope, it registers the current subscriber as a dependency.

src/routes/solid-router/concepts/data.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"nesting.mdx",
99
"layouts.mdx",
1010
"alternative-routers.mdx",
11-
"queries.mdx",
1211
"actions.mdx"
1312
]
1413
}

0 commit comments

Comments
 (0)