Skip to content

Commit 984904b

Browse files
Hasan-Mirkodiakhq[bot]LadyBluenotesatilafassinaedemaine
authored
Fix grammar and typos (#953)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Sarah <gerrardsarah@gmail.com> Co-authored-by: Atila Fassina <atila@fassina.eu> Co-authored-by: Erik Demaine <edemaine@mit.edu>
1 parent d097ca2 commit 984904b

File tree

17 files changed

+32
-32
lines changed

17 files changed

+32
-32
lines changed

src/routes/concepts/refs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function Component() {
2929
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.
3030
It can be used multiple times without having to worry about duplicate selectors.
3131

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.
3333
This makes the component's JSX structure more difficult to read and understand.
3434

3535
## Refs in Solid

src/routes/reference/basic-reactivity/create-resource.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ You can now check whether a Resource is `unresolved`, `pending`, `ready`, `refre
9797
| `refreshing` | Yes | Yes | No |
9898
| `error` | No | No | Yes |
9999

100-
2. When server rendering 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.
101101
You can use the new `ssrLoadFrom` option for this.
102102
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.
103103

src/routes/reference/basic-reactivity/create-signal.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: createSignal
33
---
44

55
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.
77

88
```tsx
99
import { createSignal } from "solid-js"
@@ -39,7 +39,7 @@ Calling the getter (e.g., `count()` or `ready()`) returns the current value of t
3939
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.
4040

4141
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.
4343
The updated value is also returned by the setter. As an example:
4444

4545
```tsx
@@ -102,7 +102,7 @@ const [count, setCount] = createSignal(0, {
102102
})
103103
```
104104

105-
Here's are some examples of this option in use:
105+
Here are some examples of this option in use:
106106

107107
```tsx
108108
// use { equals: false } to allow modifying object in-place;
@@ -115,7 +115,7 @@ setObject((current) => {
115115
return current
116116
})
117117

118-
// use { equals: false } signal as trigger without value:
118+
// use { equals: false } to create a signal that acts as a trigger without storing a value:
119119
const [depend, rerun] = createSignal(undefined, { equals: false })
120120
// now calling depend() in a tracking scope
121121
// makes that scope rerun whenever rerun() gets called

src/routes/reference/component-apis/children.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ function children(fn: () => JSX.Element): () => ResolvedChildren
1010

1111
```
1212

13-
The children's helper is used for more complex interactions with props.
14-
When you're not just passing children to another component using props.children once in JSX, you should use children.
15-
Props are normally passed in via a getter for props.children in this manner:
13+
The `children` helper is used for more complex interactions with props.
14+
When you're not just passing children to another component using `props.children` once in JSX, you should use `children`.
15+
Props are normally passed in via a getter for `props.children` in this manner:
1616

1717
```tsx
1818
const resolved = children(() => props.children)
@@ -57,7 +57,7 @@ const resolved = children(() => props.children)
5757
return <Show when={visible()}>{resolved()}</Show>
5858
```
5959

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 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.
6161
Another nice workaround is to pass `props.children` to the children helper only when you actually want to evaluate the children:
6262

6363
```tsx

src/routes/reference/component-apis/create-context.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ order: 5
77
Context provides a form of dependency injection in Solid.
88
It is used to save from needing to pass data as props through intermediate components (aka** prop drilling**).
99
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.
1111

1212
## Usage
1313

src/routes/reference/components/show.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: <Show>
33
order: 5
44
---
55

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.
77

88
```ts
99
import { Show } from "solid-js"
@@ -17,23 +17,23 @@ function Show<T>(props: {
1717
}): () => JSX.Element
1818
```
1919

20-
Here's an example of using the Show control flow:
20+
Here's an example of using the `Show` control flow:
2121

2222
```tsx
2323
<Show when={state.count > 0} fallback={<div>Loading...</div>}>
2424
<div>My Content</div>
2525
</Show>
2626
```
2727

28-
Show can also be used as a way of keying blocks to a specific data model. For example the function is re-executed whenever the user model is replaced.
28+
`Show` can also be used as a way of keying blocks to a specific data model. For example the function is re-executed whenever the user model is replaced.
2929

3030
```tsx
3131
<Show when={state.user} fallback={<div>Loading...</div>} keyed>
3232
{(user) => <div>{user.firstName}</div>}
3333
</Show>
3434
```
3535

36-
If the `keyed` property is not used, the argument of a child function will be an accessor containing the item.
36+
If the `keyed` property is not used, the argument of the child function will be an accessor containing the item.
3737

3838
```tsx
3939
<Show when={state.user} fallback={<div>Loading...</div>}>
@@ -47,4 +47,4 @@ If the `keyed` property is not used, the argument of a child function will be an
4747
| :--------- | :-------------------------------- | :-------------------------------------------- |
4848
| `when` | `T \| undefined \| null \| false` | The value to test for truthiness |
4949
| `keyed` | `boolean` | Whether to key the block to the value of when |
50-
| `fallback` | `JSX.Element` | The fallback to render when when is falsy |
50+
| `fallback` | `JSX.Element` | The fallback to render when the `when` is falsy |

src/routes/reference/components/suspense.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: <Suspense>
33
order: 5
44
---
55

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.
77

88
```tsx
99
import { Suspense } from "solid-js"
@@ -30,7 +30,7 @@ Here's an example of a `Suspense` component that shows a loading spinner while t
3030
`<Suspense>` is triggered whenever a resource is read under the suspense boundary, and waits until all resources read
3131
under the suspense boundary have resolved. Often, however, you may not want this behavior. For example, if your entire page is
3232
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
3434
closest suspense boundary.
3535

3636
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 = () => {
5252

5353
## The purpose of {"<Suspense>"}
5454

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.
5656

5757
Our example use case is to display a user profile. A naive snippet would look like this:
5858

@@ -112,7 +112,7 @@ const MyComponentWithSuspense = () => {
112112
113113
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).
114114
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.
116116
117117
With this in mind, we can understand that there isn't much gained from suspense in the following code:
118118

src/routes/reference/jsx-attributes/ref.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ Refs are a way of getting access to underlying DOM elements in our JSX. While it
99
// variable assigned directly by ref
1010
let myDiv;
1111

12-
// use onMount or createEffect to read after connected to DOM
12+
// use onMount or createEffect to read after connected to the DOM
1313
onMount(() => console.log(myDiv));
1414

1515
<div ref={myDiv} />
1616

17-
// Or, callback function (called before connected to DOM)
17+
// Or, callback function (called before connected to the DOM)
1818
<div ref={el => console.log(el)} />
1919
```
2020

src/routes/reference/reactive-utilities/from.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This basically turns any subscribable (object with a subscribe method) into a Si
2424
const signal = from(obsv$)
2525
```
2626

27-
It can also take a custom producer function where the function is passed a setter function that returns a unsubscribe function:
27+
It can also take a custom producer function where the function is passed a setter function that returns an unsubscribe function:
2828

2929
```tsx
3030
const clock = from((set) => {

src/routes/reference/reactive-utilities/run-with-owner.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Having a (correct) owner is important for two reasons:
1919
- Computations without an owner cannot be cleaned up.
2020
For example, if you call `createEffect` without an owner (e.g., in the global scope), the effect will continue running forever, instead of being disposed when its owner gets disposed.
2121

22-
- useContext obtains context by walking up the owner tree to find the nearest ancestor providing the desired context.
22+
- `useContext` obtains context by walking up the owner tree to find the nearest ancestor providing the desired context.
2323
So without an owner you cannot look up any provided context (and with the wrong owner, you might obtain the wrong context).
2424

2525
Manually setting the owner is especially helpful when doing reactivity outside of any owner scope.

0 commit comments

Comments
 (0)