You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//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;
173
172
//This will behave reactively
174
173
</script>
175
174
@@ -318,7 +317,7 @@ In the code block above `Vue is awesome` is rendered if vueVotes is more than so
318
317
319
318
### Solid
320
319
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.
322
321
323
322
##### Show
324
323
@@ -354,7 +353,7 @@ In the above code if none of the `when` conditions are satisfied it will render
354
353
355
354
##### Dynamic
356
355
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
358
357
359
358
```jsx
360
359
import { render, Dynamic } from "solid-js/web";
@@ -390,25 +389,27 @@ function App() {
390
389
}
391
390
```
392
391
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.
394
395
395
396
## List Rendering
396
397
397
398
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.
398
399
399
400
### Vue
400
401
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:
402
403
403
404
```html
404
405
<li v-for="item in items">{{ item.message }}</li>
405
406
```
406
407
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.
408
409
409
410
### Solid
410
411
411
-
In Solid the `<For>` component is the best way to loop over an array ofobjects. 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 ofobjects. 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
412
413
413
414
```html
414
415
<For each="{items()}"
@@ -418,12 +419,17 @@ In Solid the `<For>` component is the best way to loop over an array of objects.
418
419
>
419
420
```
420
421
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.
422
423
423
424
## Vue vs. Solid
424
425
425
-
<VueVsSolid />
426
+
Here's a table differentiating hooks in Vue against hooks in Solid.
0 commit comments