Avstemning
Stemmer: 23
function Counter() {
const [count, setCount] = useState(0)
return (
<>
<span>Count is {count}</span>
<button onClick={() => setCount(count + 1)}>Bump</button>
</>
);
}
@Component({
selector: 'app-counter',
templateUrl: './counter.component.html',
styleUrls: ['./counter.component.css']
})
export class CounterComponent {
count = 0
increment(){
this.count++
}
}
<span>Count is {{count}}</span>
<button (click)="increment()">Bump</button>
<script setup lang="ts">
const count = ref(0)
</script>
<template>
<span>Count is {{count}}</span>
<button @click="count++">Bump</button>
</template>
<style scoped>
</style>
<script lang="ts">
let count = 0
</script>
<span>Count is {count}</span>
<button on:click={() => count++}>Bump</button>
<style>
</style>
Avstemning
Stemmer: 23
function MyComponent() {
const world = 'CapraCon'
return (
<>
<h1>Hello {world}</h1>
<p>Do you like JSX?</p>
</>
);
}
<h1>Hello {{world}}</h1>
<p>Do you like HTML?</p>
<script>
const world = 'CapraCon'
</script>
<h1>Hello {world}</h1>
<p>Do you like SFC?</p>
<style></style>
Avstemning
Stemmer: 23
{ day && <p>☀️</p> }
<p v-if="day">☀️</p>
{#if day}
<p>☀️</p>
{/if}
Avstemning
Stemmer: 23
<ul>
{todos.map(todo =>
<li key={todo.id}>{todo.text}</li>
)}
</ul >
<ul>
<li
*ngFor="let todo of todos; trackBy: trackByFn"
>{{todo.text}}</li>
</ul>
<ul>
<li v-for="todo in todos" :key="todo.id">{{todo.text}}</li>
</ul>
<ul>
{#each todos as todo (todo.id)}
<li>{todo}</li>
{/each}
</ul>
Avstemning
Stemmer: 22
const [position, setPosition] = useState({ x: 0, y: 0 })
const moveX = (x) => setPosition({...position, x: x})
class MyComponent {
position = { x: 0, y: 0 }
moveX(x: number){
this.position.x = x
}
}
const position = reactive({ x: 0, y: 0 })
const moveX = (x) => position.x = x
const position = { x: 0, y: 0 }
const moveX = (x) => position.x = x
Avstemning
Stemmer: 22
const [count, setCount] = useState(0)
const double = count * 2
class MyComponent {
count = 0
double(){
return this.count * 2
}
}
const count = ref(0)
const double = computed(() => count.value * 2)
let count = 0
$: double = count * 2
Avstemning
Stemmer: 22
function MyComponent(props: { count: number }){
}
class MyComponent {
@Input() count!: number
}
<script setup lang="ts">
defineProps<{
count: number
}>()
</script>
<script lang="ts">
export let count: number
</script>
Avstemning
Stemmer: 28
Poeng | |
---|---|
React | 40 🏅 |
Vue | 27 🏅 |
Svelte | 21 🏅 |
Angular | 12 🏅 |
Vue | Svelte | React | Angular | |
---|---|---|---|---|
Vendor | 18.10kb | 1.54kb | 38.55kb | 41.74kB |
Component | 1.45kb | 2.31kb | 1.56kb | 1.68kB |
Komponenter | Vue | Svelte | React | Angular |
---|---|---|---|---|
10 | 6 🏅 | 10 🏅 | ||
50 | 10 🏅 | 3 🏅 | 3 🏅 | |
200 | 10 🏅 | 4 🏅 | 2 🏅 |
Vue | Svelte | React | Angular | |
---|---|---|---|---|
Data changes | 10 🏅 | 8 🏅 | ||
Startup | 6 🏅 | 9 🏅 | 2 🏅 | |
Memory allocation | 6 🏅 | 10 🏅 | 1 🏅 |
Poeng | |
---|---|
React | 20 🏅 |
Vue | 9 🏅 |
Angular | 6 🏅 |
Svelte | 2 🏅 |
Metaframework | Poeng | |
---|---|---|
React | +5 | 30 🏅 |
Vue | +3 | 18🏅 |
Svelte | +1 | 9🏅 |
Angular | +1 | 6🏅 |
Vinner