Skip to content

Commit 5cd59aa

Browse files
committed
fixed table parsing, corrected vue comparison a bit and improved quality of favicon.ico
1 parent 94cff70 commit 5cd59aa

5 files changed

Lines changed: 34 additions & 64 deletions

File tree

content/how-to-guides/comparison/vue.mdx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CodeTabs } from "~/components/Tabs";
2-
import VueVsSolid from "./vuevssolid";
32

43
<Title>Comparison with Vue</Title>
54

@@ -154,7 +153,7 @@ export const storeUsingRef = ref(0);
154153
import { storeUsingRef } from "./store.js";
155154
156155
//Note: to make use of ref() values in the script section you will have to use the .value property like so:
157-
const reactiveLocalValue = storeUsingRef();
156+
const reactiveLocalValue = storeUsingRef.value;
158157
//This will behave reactively
159158
</script>
160159
@@ -169,7 +168,7 @@ const reactiveLocalValue = storeUsingRef();
169168
import { storeUsingRef } from "./store.js";
170169
171170
//Note: to make use of ref() values in the script section you will have to use the .value property like so:
172-
const reactiveLocalValue = storeUsingRef();
171+
const reactiveLocalValue = storeUsingRef.value;
173172
//This will behave reactively
174173
</script>
175174
@@ -318,7 +317,7 @@ In the code block above `Vue is awesome` is rendered if vueVotes is more than so
318317

319318
### Solid
320319

321-
Solid has components similar to these that make conditional rendering very easy and look much cleaner. These components are namely `Show`, `Switch` and `Dynamic`. Let's take a look at how these can be used
320+
Solid has components similar to these that make conditional rendering very easy and look much cleaner. These components are namely `Show`, `Switch` and `Dynamic`. Let's take a look at how these can be used.
322321

323322
##### Show
324323

@@ -354,7 +353,7 @@ In the above code if none of the `when` conditions are satisfied it will render
354353
355354
##### Dynamic
356355
357-
This can be used to render from data. It lets you pass either a string for a native element or a component function and it will render that with the rest of the provided props.
356+
This built in component can be used to render elements from a map of keys and components/elements. It takes in a prop called component and dynamically renders out which ever element or component it is passed. You can take advantage of this by passing in a component dynamically using a map and key. Here's a quick example to show you how it's used
358357
359358
```jsx
360359
import { render, Dynamic } from "solid-js/web";
@@ -390,25 +389,27 @@ function App() {
390389
}
391390
```
392391
393-
In the above code the component that is chosen to render depends on the drop down option chosen.
392+
In the above code the component that is chosen to render depends on the drop down option chosen which serves as a key to the map of components.
393+
394+
Feel free to experiment with and use which ever built in component makes you comfortable.
394395
395396
## List Rendering
396397
397398
A lot of times developers find themselves using lists more often than not. In the case where you would like to iterate over and render objects in regards to lists or arrays within your app, some frontend frameworks offer a way for you to do that fairly easily. Let's take a look at how **Vue** and **Solid** make that possible.
398399

399400
### Vue
400401

401-
In Vue they make use of the `for` directive to render a list or array of items, like so:
402+
In Vue you make use of the `for` directive to render a list or array of items, like so:
402403

403404
```html
404405
<li v-for="item in items">{{ item.message }}</li>
405406
```
406407

407-
In the above code Vue renders as many `<li></li>` objects as there are items in the items array.
408+
In the above code Vue renders as many `<li></li>` elements as there are items in the items array.
408409

409410
### Solid
410411

411-
In Solid the `<For>` component is the best way to loop over an array of objects. As the array changes, `<For>` updates or moves items in the DOM rather than recreating them. Let's look at an example
412+
In Solid the `<For>` component is the best way to loop over an array of objects. As the array changes, `<For>` updates or moves items in the DOM rather than recreating them. Let's look at an example using the `<For>` component
412413
413414
```html
414415
<For each="{items()}"
@@ -418,12 +419,17 @@ In Solid the `<For>` component is the best way to loop over an array of objects.
418419
>
419420
```
420421
421-
There is one prop on the `<For>` component: each, where you pass the array to loop over.
422+
There is one prop in the `<For>` component called each, this is where you pass the array you wish to loop over.
422423
423424
## Vue vs. Solid
424425
425-
<VueVsSolid />
426+
Here's a table differentiating hooks in Vue against hooks in Solid.
426427

427-
| Vue(composition) | Vue(options) | Solid |
428-
| ---------------- | ------------ | --------- |
429-
| onMounted() | mounted | onMount() |
428+
| Vue(composition) | Vue(options) | Solid |
429+
| ---------------- | ---------------------- | -------------- |
430+
| onMounted() | mounted | onMount() |
431+
| onUnmounted() | unmounted | onCleanup() |
432+
| ref() | data | createSignal() |
433+
| reactive() | data | createStore() |
434+
| computed() | computed | createMemo() |
435+
| watchEffect() | this.$watch() or watch | createEffect() |

content/how-to-guides/comparison/vuevssolid.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

public/favicon.ico

1.76 KB
Binary file not shown.

src/md.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ export default {
145145
</pre>
146146
</>
147147
),
148+
table: (props) => (
149+
<table class="w-full my-6 rounded-1xl dark:bg-[rgba(17,24,39,1)] shadow-lg text-left overflow-hidden">
150+
{props.children}
151+
</table>
152+
),
153+
th: (props) => <th class="p-4">{props.children}</th>,
154+
thead: (props) => (
155+
<thead class="dark:border-blue-400 border-b-1">{props.children}</thead>
156+
),
157+
td: (props) => <td class="p-4">{props.children}</td>,
158+
tr: (props) => (
159+
<tr class="dark:even-of-type:bg-[#23406e] light:even-of-type:bg-[#90C2E7]">{props.children}</tr>
160+
),
148161
"data-lsp": (props) => {
149162
const id = createUniqueId();
150163
createEffect(() => {

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default defineConfig({
2525
providerImportSource: "solid-mdx",
2626
rehypePlugins: [rehypeSlug, [rehypeRaw, { passThrough: nodeTypes }]],
2727
remarkPlugins: [
28-
remarkGfm
28+
remarkGfm,
2929
[
3030
remarkShikiTwoslash.default,
3131
{

0 commit comments

Comments
 (0)