Skip to content

Commit 711e76c

Browse files
committed
fix broken jsx
1 parent 6bef1a0 commit 711e76c

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
@@ -23,15 +23,15 @@ This provides a concise and readable way to create and represent components.
2323

2424
Solid was designed to align closely with HTML standards.
2525

26-
```jsx
26+
```tsx
2727
const element = <h1>I'm JSX!!</h1>
2828
```
2929

3030
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.
3131
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.
3232
This lets you use dynamic expressions within your HTML by allowing variables and functions to be references with the use of curly braces (`{ }`):
3333

34-
```jsx
34+
```tsx
3535
const Component = () => {
3636
const animal = { breed: "cat", name: "Midnight" }
3737

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

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

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

74-
```jsx
74+
```tsx
7575
<img src="./image-here.png" />
7676
```
7777

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

96-
```jsx
96+
```tsx
9797
<button class="myClass" onClick={handleClick}>
9898
Click me!
9999
</button>
100100
```
101101

102-
:::note
103-
If you wish to pass objects in JSX, such as with inline styling, you will have to use double curly braces (`{{ }}`).
102+
:::note
103+
104+
If you wish to pass objects in JSX, such as with inline styling, you will have to use double curly braces (`{{ }}`).
104105

105-
```jsx
106+
```tsx
106107
<button style={{
107108
color: 'red',
108109
font-size: '2rem',
109110
}}>
110111
Click me!
111112
</button>
112113
```
114+
113115
:::
114116

115117
### JSX properties (props)
@@ -132,10 +134,12 @@ They connect the component with the data it requires, for seamless data flows an
132134
This results in components that react in real-time to data changes.
133135

134136
:::note
137+
135138
Expressions, whether fixed or dynamic, get applied *in the order defined within the JSX*.
136139
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'`.
137140

138141
When order influences an element's behavior, users must define the expressions in the order that the element is expected.
142+
139143
:::
140144

141145
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)