-
Notifications
You must be signed in to change notification settings - Fork 329
Docs Updates #1230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
LadyBluenotes
wants to merge
55
commits into
main
Choose a base branch
from
v2-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Docs Updates #1230
Changes from 6 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
2e619e5
start of v2 structure
LadyBluenotes 780750c
Improve data fetching docs (#1179)
amirhhashemi 20cf242
quick start
LadyBluenotes a67220a
update titles and reactivity basics page
LadyBluenotes 2d97093
focused signals page
LadyBluenotes ce0da5c
understanding JSX page
LadyBluenotes 21e2e8c
Merge branch 'main' into v2-docs
kodiakhq[bot] b41f22c
Merge branch 'main' into v2-docs
kodiakhq[bot] da9300d
Merge branch 'main' into v2-docs
kodiakhq[bot] aeac1e6
Merge branch 'main' into v2-docs
kodiakhq[bot] 4d1d09d
Merge branch 'main' into v2-docs
kodiakhq[bot] a96251c
new files
LadyBluenotes 8c8931b
Merge branch 'main' into v2-docs
kodiakhq[bot] dae6b8a
Merge branch 'main' into v2-docs
kodiakhq[bot] ca815ce
workign on new pages
LadyBluenotes b6a0505
Merge branch 'main' into v2-docs
kodiakhq[bot] 9d5c443
Merge branch 'main' into v2-docs
kodiakhq[bot] 8e8789d
Merge branch 'main' into v2-docs
kodiakhq[bot] 1ba03a9
Merge branch 'main' into v2-docs
kodiakhq[bot] a229b75
Merge branch 'main' into v2-docs
kodiakhq[bot] 40b4f5b
Merge branch 'main' into v2-docs
kodiakhq[bot] 5ec20ef
Merge branch 'main' into v2-docs
kodiakhq[bot] 41709a6
Merge branch 'main' into v2-docs
kodiakhq[bot] eef1c9b
Merge branch 'main' into v2-docs
kodiakhq[bot] 736cd9a
Merge branch 'main' into v2-docs
kodiakhq[bot] db0956b
Merge branch 'main' into v2-docs
kodiakhq[bot] daf1c5c
Update src/routes/getting-started/quick-start.mdx
LadyBluenotes a55927a
Apply suggestions from code review
LadyBluenotes 0f5f21b
effects
LadyBluenotes e773cb2
Closes issues #649 and #968 (#1251)
thomasbuilds 348aea9
Addresses Issue #1183 (#1252)
thomasbuilds 832a918
Bump @types/node from 24.3.0 to 24.3.1 (#1254)
dependabot[bot] a297414
Bump eslint from 9.34.0 to 9.35.0 (#1256)
dependabot[bot] 8e5abe9
Bump dotenv from 17.2.1 to 17.2.2 (#1255)
dependabot[bot] 62261b1
Bump @typescript-eslint/parser from 8.41.0 to 8.43.0 (#1257)
dependabot[bot] f066063
Bump typescript-eslint from 8.41.0 to 8.43.0 (#1258)
dependabot[bot] 0187c05
remove random `;` symbol from splitProps docs (#1260)
JLarky b1e1076
Addresses #547 (#1253)
thomasbuilds 2230518
Addressed issue #1259 (#1262)
thomasbuilds 6677dd2
Fix code example error in create-effect.mdx (#1261)
WavJaby a9105fe
Bump zod from 4.1.5 to 4.1.8 (#1268)
dependabot[bot] c576beb
Bump @solidjs/start from 1.1.7 to 1.2.0 (#1266)
dependabot[bot] cce5056
Bump @eslint/js from 9.34.0 to 9.35.0 (#1265)
dependabot[bot] 42bee6a
Bump globals from 16.3.0 to 16.4.0 (#1267)
dependabot[bot] 2581e1b
Remove "variables" from createEffect dependency examples (#1269)
Mind-of-Apollo c34397b
start of v2 structure
LadyBluenotes 8e9c161
fix broken jsx
LadyBluenotes 795ea93
derived state section
LadyBluenotes 741243c
working on stores page
LadyBluenotes 4f5d07a
fix broken link:
LadyBluenotes 01d9c0e
Bump @types/node from 24.3.1 to 24.5.0 (#1264)
dependabot[bot] 09138ff
start of v2 structure
LadyBluenotes 39cbee3
fix getting-started
LadyBluenotes 673d79e
rm old component
LadyBluenotes bd8bfff
remove lunaria
LadyBluenotes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
title: Signals | ||
order: 2 | ||
--- | ||
|
||
Signals are the **core primitive for state** in Solid. | ||
They provide a way to store a value, read it, and update it. | ||
When a signal changes, anything that depends on it will update automatically. | ||
|
||
Signals can represent any kind of state in your application: | ||
- simple values like numbers or strings | ||
- complex values like objects or arrays | ||
- application state such as the current user, theme, or page | ||
|
||
For an overview of how signals fit into Solid’s reactive model, see [Reactivity Basics](/reactivity/basics). | ||
|
||
## Creating a signal | ||
LadyBluenotes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Use [`createSignal`](/reference/basic-reactivity/create-signal) from `solid-js` to create a signal. | ||
It returns a pair of functions: | ||
- a **getter** to read the value | ||
- a **setter** to update the value | ||
LadyBluenotes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
```jsx | ||
import { createSignal } from "solid-js"; | ||
|
||
const [count, setCount] = createSignal(0); | ||
// ^ getter ^ setter | ||
``` | ||
|
||
:::note | ||
The syntax using `[` and `]` is called [array destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment). | ||
|
||
This lets you extract values from the array. | ||
In the context of `createSignal`, the first value is the getter function, and the second value is the setter function. | ||
::: | ||
|
||
## Accessing values | ||
LadyBluenotes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The getter function returned by `createSignal` is used to access the value of the signal. | ||
Call the getter function with no arguments to read the current value: | ||
|
||
```jsx | ||
console.log(count()); // 0 | ||
``` | ||
|
||
## Updating values | ||
LadyBluenotes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The setter function returned by `createSignal` is used to update the value of the signal. | ||
This function takes an argument that represents the new value of the signal: | ||
|
||
```jsx | ||
setCount(count() + 1); | ||
|
||
console.log(count()); // 1 | ||
LadyBluenotes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
``` | ||
|
||
The setter function can also take a function that passes the previous value. | ||
|
||
```jsx | ||
setCount((prevCount) => prevCount + 1); | ||
|
||
console.log(count()); // 1 | ||
LadyBluenotes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
``` | ||
|
||
## Reactivity | ||
|
||
Signals are **reactive**, which means that they automatically update when their value changes. | ||
For example, using a signal inside JSX automatically makes the DOM update when the signal changes: | ||
LadyBluenotes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
```jsx | ||
function Counter() { | ||
const [count, setCount] = createSignal(0); | ||
const increment = () => setCount((prev) => prev + 1); | ||
|
||
return ( | ||
<div> | ||
<span>Count: {count()}</span> {/* Updates when `count` changes */} | ||
<button type="button" onClick={increment}> | ||
Increment | ||
</button> | ||
</div> | ||
); | ||
} | ||
``` | ||
|
||
To learn how signals connect to effects and tracking scopes, see: | ||
- [Reactive Side Effects](/reactivity/effects) | ||
LadyBluenotes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- [Memoized Computations](/reactivity/memo) | ||
|
||
## Related Pages | ||
|
||
- [Reactivity Basics](/reactivity/basics) | ||
- [Reactive Side Effects](/reactivity/effects) | ||
- [Memoized Computations](/reactivity/memo) | ||
- [Introduction to Components](/components/intro) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"title": "Guides", | ||
"pages": [ | ||
"styling-your-components.mdx", | ||
"styling-components", | ||
"state-management.mdx", | ||
"routing-and-navigation.mdx", | ||
"complex-state-management.mdx", | ||
"fetching-data.mdx", | ||
"testing.mdx", | ||
"deploying-your-app.mdx", | ||
"deployment-options" | ||
] | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "Advanced Concepts", | ||
"pages": [] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "Components", | ||
"pages": ["intro.md", "how-to"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "How-to", | ||
"pages": ["event-listeners.mdx", "styling.mdx"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
title: "Using Event Listeners" | ||
--- | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
title: "Styling Components" | ||
--- | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: "Intro to Components" | ||
order: 1 | ||
--- | ||
|
||
[TODO] | ||
|
||
## Component lifecycle | ||
|
||
[TODO] |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "Control Flow", | ||
"pages": [] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"title": "Getting Started", | ||
"pages": ["quick-start.mdx", "counter.mdx", "todo.mdx"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
title: Quick Start | ||
order: 1 | ||
--- | ||
|
||
The fastest way to try Solid is to create a new project and run it locally. | ||
In just a few minutes, you’ll have a working Solid app running in your browser. | ||
|
||
## Solid in your Browser | ||
|
||
If you're looking to experiment with Solid without setting up a local environment, open the [Solid Playground](https://playground.solidjs.com/) in your browser. | ||
|
||
If you prefer a more complete development setup, you can use the StackBlitz [Javascript](https://stackblitz.com/github/solidjs/templates/tree/master/js) or [TypeScript](https://stackblitz.com/github/solidjs/templates/tree/master/ts) templates. | ||
|
||
## Create a New Project | ||
|
||
:::note[Before You Begin] | ||
Make sure you have a recent version of your preferred JavaScript runtime installed, such as [Node.js](https://nodejs.org/en), [Bun](https://bun.sh/), or [Deno](https://deno.com/). | ||
::: | ||
|
||
To create a new Solid project, follow these steps: | ||
|
||
1. **Open your terminal and navigate to the directory** where you want to create your project. | ||
|
||
2. **Run the following command:** | ||
|
||
```package-create | ||
solid | ||
``` | ||
|
||
3. **Follow the CLI prompts** to select your project name, template (JavaScript or TypeScript), and other options. | ||
|
||
```sh | ||
◆ Project Name | ||
| <solid-project> | ||
|
||
◆ Is this a SolidStart project? | ||
| ● Yes / ○ No | ||
|
||
◆ Which template would you like to use? | ||
│ ● ts | ||
│ ○ ts-vitest | ||
│ ○ ts-uvu | ||
│ ○ ts-unocss | ||
│ ○ ts-tailwindcss | ||
|
||
◆ Use TypeScript? | ||
│ ● Yes / ○ No | ||
LadyBluenotes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
``` | ||
|
||
4. **Follow the instructions to install the dependencies and start the development server:** | ||
|
||
```sh title="npm" tab="package-manager" | ||
cd solid-project | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
```sh title="pnpm" tab="package-manager" | ||
cd solid-project | ||
pnpm install | ||
pnpm dev | ||
``` | ||
|
||
```sh title="yarn" tab="package-manager" | ||
cd solid-project | ||
yarn install | ||
yarn dev | ||
``` | ||
|
||
```sh title="bun" tab="package-manager" | ||
cd solid-project | ||
bun install | ||
bun run dev | ||
``` | ||
|
||
```sh title="deno" tab="package-manager" | ||
cd solid-project | ||
deno install | ||
deno run dev | ||
``` | ||
|
||
6. **Open your browser and go to the local URL** provided in the terminal to see your new Solid app in action! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: Todo Tutorial | ||
order: 3 | ||
--- | ||
|
||
[TODO] | ||
|
||
1. Open your newly scaffolded project in your code editor of choice. | ||
|
||
- Signal to track all tasks | ||
- Function to add a new task | ||
- Function to remove a task | ||
- Function to toggle task completion | ||
- Show number of completed tasks | ||
- Show number of tasks |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.