July 1, 2022

Why I used astro instead of vue/react

Why I used astro instead of vue/react

It has been a while since Vue 3 was fully released, but one concept that still stumps newcomers to the framework is understanding the key differences between ref and reactive when working with the composition API.

saban

I don’t want to do a complete rewrite of the docs, so let’s first get out of the way the more “obvious” difference, or the key one that absolute everyone must understand before working with these two.


Why write ref and active?

  • ref is used to create a reactive reference to a value.
  • reactive is used to create a reactive object.
/src/components/HelloWorld.vue
<template>
<div>Hey there</div>
</template>
<script>
const a = 1;
</script>

Why react is better than vue

React is better than vue because of the following reasons:

  • React is more popular than vue
    • React has a larger community
  • React has more job opportunities
  • React has more libraries
/some.ts
// read-only
function computed<T>(
getter: (oldValue: T | undefined) => T,
// see "Computed Debugging" link below
debuggerOptions?: DebuggerOptions
): Readonly<Ref<Readonly<T>>>
// writable
function computed<T>(
options: {
get: (oldValue: T | undefined) => T
set: (value: T) => void
},
debuggerOptions?: DebuggerOptions
): Ref<T>

But why to do it?

The params key of every returned object tells Astro what routes to build. The returned params must map back to the dynamic parameters and rest parameters defined in your component filepath.

params are encoded into the URL, so only strings are supported as values. The value for each params object must match the parameters used in the page name.

For example, suppose that you have a page at src/pages/posts/[id].astro. If you export getStaticPaths from this page and return the following for paths: It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.