Skip to content

Commit e51f764

Browse files
Merge branch 'main' into add-data-mutation-guide
2 parents 6bb8293 + 17509cd commit e51f764

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

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

+11-10
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,36 @@ For example:
2323
```ts title="/context/counter.ts"
2424
import { createContext } from "solid-js";
2525

26-
export const DEFAULT_COUNT = 0
27-
const INTIAL_STORE_SETTER = {
28-
increment: () => void,
29-
decrement: () => void
26+
export const INITIAL_COUNT = 0;
27+
28+
const INITIAL_STORE_SETTER = {
29+
increment: () => {},
30+
decrement: () => {}
3031
};
3132

3233
export const CounterContext = createContext([
3334
{ count: INITIAL_COUNT },
34-
INTIAL_STORE_SETTER
35+
INITIAL_STORE_SETTER
3536
]);
3637
```
3738

3839
With the context created in its own module, you can use to instantiate the context provider.
3940

4041
```ts title="/context/counter-component.tsx"
4142
import { createStore } from 'solid-js/store';
42-
import { CounterContext, DEFAULT_COUNT } from "./counter.ts";
43+
import { CounterContext, INITIAL_COUNT } from "./counter.ts";
4344

4445
export function CounterProvider(props) {
45-
const [value, setValue] = createStore({ count: props.initialCount || DEFAULT_COUNT })
46+
const [value, setValue] = createStore({ count: props.initialCount || INITIAL_COUNT })
4647

47-
const counter = [
48+
const counter = [
4849
value,
4950
{
5051
increment() {
5152
setValue("count", currentCount => currentCount + 1)
5253
},
5354
decrement() {
54-
setValue("count", currentcount => currentCount - 1)
55+
setValue("count", currentCount => currentCount - 1)
5556
},
5657
},
5758
]
@@ -98,4 +99,4 @@ interface Context<T> {
9899
}
99100

100101
function createContext<T>(defaultValue?: T): Context<T | undefined>
101-
```
102+
```

src/routes/solid-router/advanced-concepts/lazy-loading.mdx

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ In Solid Router, you can lazy load components using the `lazy` function from Sol
1111
import { lazy } from "solid-js";
1212
import { Router, Route } from "@solidjs/router";
1313

14-
const Home = () => import("./Home");
14+
const Home = lazy(() => import("./Home"));
15+
1516
const Users = lazy(() => import("./Users"));
17+
1618
const App = () => (
1719
<Router>
18-
<Route path="/" component={<Home />} />
19-
<Route path="/users" component={<Users />} />
20+
<Route path="/" component={Home} />
21+
<Route path="/users" component={Users} />
2022
</Router>
2123
);
2224
```

src/routes/solid-start/building-your-application/routing.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ This will allow you to create a new route that is not nested under the previous
138138
|-- routes/ // example.com
139139
|-- users/
140140
|-- index.tsx // example.com/users
141-
|-- projects.tsx // example.com/projects
141+
|-- projects.tsx // example.com/users/projects
142142
|-- users(details)/
143143
|-- [id].tsx // example.com/users/1
144144
```

src/ui/layout/hero.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ export const Hero: Component = () => {
9999
>
100100
<Index each={snippetLines}>
101101
{(_, index) => (
102-
<pre class="pb-px">
103-
{(index + 1).toString().padStart(2, "0")}
104-
</pre>
102+
<pre>{(index + 1).toString().padStart(2, "0")}</pre>
105103
)}
106104
</Index>
107105
</div>

0 commit comments

Comments
 (0)