Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhhashemi committed Jan 2, 2025
1 parent a2e1a39 commit 92cc86c
Show file tree
Hide file tree
Showing 28 changed files with 835 additions and 339 deletions.
6 changes: 2 additions & 4 deletions .github/ISSUE_TEMPLATE/OTHER.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: "Other Report 🌐"
title: "[Other]:"
description: Report something else we should know about the docs site!
labels: [
"pending review"
]
labels: ["pending review"]
body:
- type: textarea
id: issue
Expand All @@ -12,4 +10,4 @@ body:
description: Please describe the problem with the documentation in detail.
placeholder: "..."
validations:
required: true
required: true
81 changes: 42 additions & 39 deletions src/routes/concepts/context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,23 @@ This function has a `Provider` property that wraps the component tree you want t

<TabsCodeBlocks>
<div id="/context/create.js">

```jsx
import { createContext } from "solid-js";

const MyContext = createContext();
```

````
</div>
<div id="/context/component.jsx">

```jsx
import { MyContext } from "./create";

export function Provider (props) {
return (
<MyContext.Provider>
{props.children}
</MyContext.Provider>
)
};
````
export function Provider(props) {
return <MyContext.Provider>{props.children}</MyContext.Provider>;
}
```

</div>
</TabsCodeBlocks>
Expand Down Expand Up @@ -162,6 +160,7 @@ You can pass a signal directly to the `value` prop of the `Provider` component,

<TabsCodeBlocks>
<div id="App.jsx">

```jsx
import { CounterProvider } from "./Context";
import { Child } from "./Child";
Expand All @@ -172,11 +171,13 @@ export function App() {
<h1>Welcome to Counter App</h1>
<Child />
</CounterProvider>
)
);
}
```

</div>
<div id="Context.jsx">

```jsx
import { createSignal, useContext } from "solid-js";

Expand All @@ -186,43 +187,45 @@ export function CounterProvider(props) {
count,
{
increment() {
setCount(prev => prev + 1);
setCount((prev) => prev + 1);
},
decrement() {
setCount(prev => prev - 1);
}
}
setCount((prev) => prev - 1);
},
},
];

return (
<CounterContext.Provider value={counter}>
{props.children}
</CounterContext.Provider>
);

return (
<CounterContext.Provider value={counter}>
{props.children}
</CounterContext.Provider>
);
}

export function useCounter() { return useContext(CounterContext); }
export function useCounter() {
return useContext(CounterContext);
}
```

</div>
<div id="Child.jsx">

```tsx title="/context/counter-component.tsx"
import { useCounter } from "./Context";

export function Child(props) {
const [count, { increment, decrement }] = useCounter();

return (
<>
<div>{count()}</div>
<button onClick={increment}>+</button>
<button onClick={decrement}>-</button>
</>
);

};
return (
<>
<div>{count()}</div>
<button onClick={increment}>+</button>
<button onClick={decrement}>-</button>
</>
);
}
```

````
</div>
</TabsCodeBlocks>

Expand All @@ -239,21 +242,21 @@ To solve this issue, a default value can be specified when creating a context ob
import { useContext } from "solid-js";

function useMyContext() {
const value = useContext(MyContext);
const value = useContext(MyContext);

if (!value) {
throw new Error("Missing context Provider");
}
if (!value) {
throw new Error("Missing context Provider");
}

return value;
return value;
}

function Child() {
const value = useMyContext();
const value = useMyContext();

return <div>{value}</div>;
return <div>{value}</div>;
}
````
```

## Common issues with `createContext` and `useContext`

Expand Down
34 changes: 30 additions & 4 deletions src/routes/configuration/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,39 +54,65 @@ Transitioning from JavaScript to TypeScript in a Solid project offers the benefi

<TabsCodeBlocks>
<div id="npm">

```bash frame="none"
npm i --save-dev typescript
```

</div>
<div id="yarn">

<div id="yarn">```bash frame="none" yarn add --dev typescript ```</div>
```bash frame="none"
yarn add --dev typescript
```

<div id="pnpm">```bash frame="none" pnpm add --save-dev typescript ```</div>
</div>
<div id="pnpm">

```bash frame="none"
pnpm add --save-dev typescript
```

</div>
<div id="bun">

```bash frame="none"
bun add --save-dev typescript
```

</div>
</TabsCodeBlocks>

2. Run the following command to generate a `tsconfig.json` file.

<TabsCodeBlocks>
<div id="npm">

```bash frame="none"
npx tsc --init
```

</div>
<div id="yarn">

<div id="yarn">```bash frame="none" yarn dlx tsc --init ```</div>
```bash frame="none"
yarn dlx tsc --init
```

<div id="pnpm">```bash frame="none" pnpm tsc --init ```</div>
</div>
<div id="pnpm">

```bash frame="none"
pnpm tsc --init
```

</div>
<div id="bun">

```bash frame="none"
bunx tsc --init
```

</div>
</TabsCodeBlocks>

Expand Down
72 changes: 56 additions & 16 deletions src/routes/guides/deployment-options/aws-via-sst.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,34 @@ mainNavExclude: true
2. In your project, init SST.

<TabsCodeBlocks>
<div id="npm">```bash frame="none" npx sst@latest init ```</div>
<div id="yarn">```bash frame="none" yarn dlx sst@latest init ```</div>
<div id="pnpm">```bash frame="none" pnpm dlx sst@latest init ```</div>
<div id="bun">```bash frame="none" bunx sst@latest init ```</div>
<div id="npm">

```bash frame="none"
npx sst@latest init
```

</div>
<div id="yarn">

```bash frame="none"
yarn dlx sst@latest init
```

</div>
<div id="pnpm">

```bash frame="none"
pnpm dlx sst@latest init
```

</div>
<div id="bun">

```bash frame="none"
bunx sst@latest init
```

</div>
</TabsCodeBlocks>

3. This will detect your SolidStart app and ask you to update your `app.config.ts`.
Expand All @@ -30,18 +54,34 @@ server: {
4. When you are ready, you can deploy your app using:

<TabsCodeBlocks>
<div id="npm">
```bash frame="none" npx sst@latest deploy --stage production ```
</div>
<div id="yarn">
```bash frame="none" yarn dlx sst@latest deploy --stage production ```
</div>
<div id="pnpm">
```bash frame="none" pnpm dlx sst@latest deploy --stage production ```
</div>
<div id="bun">
```bash frame="none" bunx sst@latest deploy --stage production ```
</div>
<div id="npm">

```bash frame="none"
npx sst@latest deploy --stage production
```

</div>
<div id="yarn">

```bash frame="none"
yarn dlx sst@latest deploy --stage production
```

</div>
<div id="pnpm">

```bash frame="none"
pnpm dlx sst@latest deploy --stage production
```

</div>
<div id="bun">

```bash frame="none"
bunx sst@latest deploy --stage production
```

</div>
</TabsCodeBlocks>

You can [read the full tutorial on the SST docs](https://sst.dev/docs/start/aws/solid).
Expand Down
Loading

0 comments on commit 92cc86c

Please sign in to comment.