You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/routes/concepts/refs.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ function Component() {
29
29
This lets you create and access DOM elements similar to [`document.createElement`](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement) but without having to wait until it is attached to the DOM.
30
30
It can be used multiple times without having to worry about duplicate selectors.
31
31
32
-
The downside to this approach is it separates the element and any child elements from the rest of the JSX structure.
32
+
The downside of this approach is that it separates the element and any child elements from the rest of the JSX structure.
33
33
This makes the component's JSX structure more difficult to read and understand.
Copy file name to clipboardExpand all lines: src/routes/reference/basic-reactivity/create-resource.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ You can now check whether a Resource is `unresolved`, `pending`, `ready`, `refre
97
97
|`refreshing`| Yes | Yes | No |
98
98
|`error`| No | No | Yes |
99
99
100
-
2. When serverrendering resources especially when fetching when embedding Solid in other system that fetch before render, you might want to initiate the resource with this prefetched value instead of fetching again and having the resource serialize it in it's own state.
100
+
2. When server-rendering resources, especially when embedding Solid in other systems that fetch data before rendering, you might want to initialize the resource with this prefetched value instead of fetching again and having the resource serialize it in its own state.
101
101
You can use the new `ssrLoadFrom` option for this.
102
102
Instead of using the default `server` value, you can pass `initial` and the resource will use `initialValue` as if it were the result of the first fetch for both SSR and hydration.
Copy file name to clipboardExpand all lines: src/routes/reference/basic-reactivity/create-signal.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: createSignal
3
3
---
4
4
5
5
Signals are the most basic reactive primitive.
6
-
They track a single value (which can be any JavaScript object) that changes over time.
6
+
They track a single value (which can be a value of any type) that changes over time.
7
7
8
8
```tsx
9
9
import { createSignal } from"solid-js"
@@ -39,7 +39,7 @@ Calling the getter (e.g., `count()` or `ready()`) returns the current value of t
39
39
Crucial to automatic dependency tracking, calling the getter within a tracking scope causes the calling function to depend on this Signal, so that function will rerun if the Signal gets updated.
40
40
41
41
Calling the setter (e.g., `setCount(nextCount)` or `setReady(nextReady)`) sets the Signal's value and updates the Signal (triggering dependents to rerun) if the value actually changed (see details below).
42
-
The setter takes either the new value for the signal or a function that maps the last value of the signal to a new value as its only argument.
42
+
The setter takes either the new value for the signal or a function that maps the previous value of the signal to a new value as its only argument.
43
43
The updated value is also returned by the setter. As an example:
To evaluate the children only when `<Show>` would render them, you can push the call to children inside a component or a function within `<Show>`, which only evaluates its children when the when condition is true.
60
+
To evaluate the children only when `<Show>` would render them, you can push the call to children inside a component or a function within `<Show>`, which only evaluates its children when `when` condition is true.
61
61
Another nice workaround is to pass `props.children` to the children helper only when you actually want to evaluate the children:
Copy file name to clipboardExpand all lines: src/routes/reference/component-apis/create-context.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ order: 5
7
7
Context provides a form of dependency injection in Solid.
8
8
It is used to save from needing to pass data as props through intermediate components (aka** prop drilling**).
9
9
This function creates a new context object that can be used with [useContext](/reference/component-apis/use-context) and offers the Provider control flow.
10
-
Default Context is used when no Provider is found above in the hierarchy.
10
+
The default value is used when no Provider is found above in the hierarchy.
Copy file name to clipboardExpand all lines: src/routes/reference/components/show.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: <Show>
3
3
order: 5
4
4
---
5
5
6
-
The Show control flow is used to conditional render part of the view: it renders children when the when is truthy, a fallback otherwise. It is similar to the ternary operator `(when ? children : fallback)` but is ideal for templating JSX.
6
+
The `Show` control flow is used to conditionally render part of the view: it renders children when `when` is truthy, a fallback otherwise. It is similar to the ternary operator `(when ? children : fallback)` but is ideal for templating JSX.
7
7
8
8
```ts
9
9
import { Show } from"solid-js"
@@ -17,23 +17,23 @@ function Show<T>(props: {
17
17
}): () =>JSX.Element
18
18
```
19
19
20
-
Here's an example of using the Show control flow:
20
+
Here's an example of using the `Show` control flow:
Copy file name to clipboardExpand all lines: src/routes/reference/components/suspense.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: <Suspense>
3
3
order: 5
4
4
---
5
5
6
-
A component that tracks all resources read under it and shows a fallback placeholder state until they are resolved. What makes `Suspense` different than `Show` is it is non-blocking in that both branches exist at the same time even if not currently in the DOM. This means that the fallback can be rendered while the children are loading. This is useful for loading states and other asynchronous operations.
6
+
A component that tracks all resources read under it and shows a fallback placeholder state until they are resolved. What makes `Suspense` different than `Show` is that it is non-blocking in the sense that both branches exist at the same time even if not currently in the DOM. This means that the fallback can be rendered while the children are loading. This is useful for loading states and other asynchronous operations.
7
7
8
8
```tsx
9
9
import { Suspense } from"solid-js"
@@ -30,7 +30,7 @@ Here's an example of a `Suspense` component that shows a loading spinner while t
30
30
`<Suspense>` is triggered whenever a resource is read under the suspense boundary, and waits until all resources read
31
31
under the suspense boundary have resolved. Often, however, you may not want this behavior. For example, if your entire page is
32
32
wrapped in suspense, you may not want a resource that only populates a certain part of the page to trigger suspense.
33
-
In that case, you can wrap that resource usage its own suspense boundary, and the resource will only trigger the
33
+
In that case, you can wrap that resource usage in its own suspense boundary, and the resource will only trigger the
34
34
closest suspense boundary.
35
35
36
36
For example, in the code below, only the `title()` resource will trigger the top level suspense boundary, and only the `data()`
@@ -52,7 +52,7 @@ const MyComponent = () => {
52
52
53
53
## The purpose of {"<Suspense>"}
54
54
55
-
To understand the purpose of suspense, let's consider the following code snippets. These snippets will have some drawbacks which we will solve by using suspense. We will also see how it is possible to use suspense yet not reap its benefits.
55
+
To understand the purpose of suspense, let's consider the following code snippets. These snippets will have some drawbacks which we will solve by using suspense. We will also see how it is possible to use `Suspense` yet not reap its benefits.
56
56
57
57
Our example use case is to display a user profile. A naive snippet would look like this:
In this case, the `div`s are created immediately, but instead of being attached to the document body, the fallback is shown. Once the resource resolves, the text in the `div`s is updated, and then they are attached to the document (and the fallback removed).
114
114
115
-
It is important to note that _execution of the component does not pause_ when using suspense. Instead, when a resource is read under a suspense boundary, it ensures that the nodes are not attached to the document until after the resource has resolved. Suspense allows us to have the best of both worlds: do as much work as we can _before_ the resource resolves, and also show a fallback until then.
115
+
It is important to note that _the execution of the component does not pause_ when using suspense. Instead, when a resource is read under a suspense boundary, it ensures that the nodes are not attached to the document until after the resource has resolved. Suspense allows us to have the best of both worlds: do as much work as we can _before_ the resource resolves, and also show a fallback until then.
116
116
117
117
With this in mind, we can understand that there isn't much gained from suspense in the following code:
0 commit comments