Skip to content

Commit 6bef1a0

Browse files
committed
start of v2 structure
1 parent 4169aa7 commit 6bef1a0

File tree

5 files changed

+124
-1
lines changed

5 files changed

+124
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: "Counter Tutorial"
3+
order: 2
4+
---
5+
6+
[TODO]
7+
8+
1. Open your newly scaffolded project in your code editor of choice.
9+
2. Create a new file called `Counter.jsx` in the `src/components` directory.
10+
3. In `Counter.tsx`, use Solid's `createSignal` to create a reactive counter state.
11+
4. Export the `Counter` component and import it into your main application file (e.g., `src/App.jsx`).
12+
5. Use the `Counter` component in your application and test its functionality.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Quick Start Guide
3+
order: 1
4+
---
5+
6+
The fastest way to try Solid is to create a new project and run it locally.
7+
In just a few minutes, you’ll have a working Solid app running in your browser.
8+
9+
## Solid in your Browser
10+
11+
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.
12+
13+
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.
14+
15+
## Create a New Project
16+
17+
:::note[Before You Begin]
18+
Make sure you have a recent version of your prefer JavaScript runtime installed, such as [Node.js](https://nodejs.org/en), [Bun](https://bun.sh/), or [Deno](https://deno.com/).
19+
:::
20+
21+
[TODO]
22+
23+
- Navigate to directory and run command
24+
- CLI will take you through options
25+
- Once you've selected your options, the CLI will prompt you to install the dependencies and start the development server
26+
- Open browser and navigate to the provided local URL to see your new Solid app in action!

src/routes/reactivity/memos.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: "Memos"
3+
order: 3
4+
---
5+
6+
[TODO:
7+
Concept page on Memos
8+
- Improve on existing page
9+
- Move relevant sections to reference and vice versa
10+
- Link out to how-to for derived signals where appropriate
11+
]

src/routes/reactivity/overview.mdx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: "Overview"
3+
order: 1
4+
---
5+
6+
[TODO: Review]
7+
8+
:::note
9+
While this guide can be helpful for understanding reactive systems, it does use some Solid-specific terminology and concepts.
10+
:::
11+
12+
Reactivity is what powers the interactivity of Solid apps.
13+
This programming paradigm refers to a system's ability to respond to changes in data, or state, automatically and efficiently.
14+
Solid is built with reactivity at the core of its design, assisting applications with staying up-to-date with its underlying data.
15+
16+
## The Importance of Reactivity
17+
18+
Reactivity is what keeps the user interface (UI) in sync with the underlying application state.
19+
When the state changes, the UI is automatically updated, reducing the need for manual updates.
20+
21+
In addition, reactivity enables real-time updates, allowing applications to reflect changes instantly without requiring a full page refresh.
22+
This helps with creating more responsive and interactive user experiences.
23+
24+
As an example, when building a Counter, you can use the reactive primitives provided by Solid to create a counter.
25+
Once the counter is set up, whenever the count changes, the UI will automatically update to reflect the new count:
26+
27+
```tsx
28+
function Counter() {
29+
const [count, setCount] = createSignal<number>(0);
30+
const increment = () => setCount((prev) => prev + 1);
31+
32+
return (
33+
<div>
34+
<span>Count: {count()}</span>{" "}
35+
{/* Only `count()` is updated when the button is clicked. */}
36+
<button type="button" onClick={increment}>
37+
Increment
38+
</button>
39+
</div>
40+
);
41+
}
42+
```
43+
44+
## Reactive Principles
45+
46+
### Signals
47+
48+
Signals serve as the core elements within a reactive system.
49+
They play a crucial role in tracking and managing state changes, allowing the UI to respond automatically when the underlying data changes.
50+
They are responsible for storing and managing data, as well as triggering updates across the system.
51+
52+
Signals are able to achieve this reactivity through the use of:
53+
54+
- **Getters**: A function responsible for retrieving the current value of a signal.
55+
When called within a reactive context, it will give access to the current value of the signal.
56+
- **Setters**: This function is responsible for updating the value of a signal.
57+
To trigger reactivity, setters notify the system that the signal's value has changed, prompting anything that depends on the signal to re-evaluate and update accordingly.
58+
59+
<EraserLink
60+
href="https://app.eraser.io/workspace/maDvFw5OryuPJOwSLyK9?elements=lseAEjGlKLslaVsTlfej_g"
61+
preview="https://app.eraser.io/workspace/maDvFw5OryuPJOwSLyK9/preview?elements=lseAEjGlKLslaVsTlfej_g&type=embed"
62+
/>
63+
64+
### Subscribers
65+
66+
Subscribers refer to other reactive contexts or components that depend on the value of a signal.
67+
These automated responders keep the system up-to-date by re-evaluating and updating whenever the signal's value changes.
68+
69+
Subscribers work based on two main actions:
70+
- **Observation**: The core function of a subscriber is to observe signals.
71+
This keeps the subscriber informed about any changes to the signal(s) they're tracking.
72+
- **Respond**: Once the signal has updated and the subscriber is notified, it triggers a re-evaluation of the dependent computations or UI updates.
73+
74+
[TODO: Some kind of image / code block??]

src/routes/reactivity/stores.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
title: "Reactive State Management"
2+
title: "Stores"
33
order: 5
44
---

0 commit comments

Comments
 (0)