Hvorfor er det jeg som står her?
Jobb | Fritid | Talks |
2019-2020, Sparebank 1: | gaute.dev: | 2022: Hvilket frontend rammeverk liker du? |
2020-*, Gjensidige: | ordle.no: | 2023: Reaktivitet i rammeverk og hva greia med signals er |
kuizzi.app: | 2024: Sånn gjør du riktig valg av frontendrammeverk i 2024 |
Solo prosjekt
Team
Bedrift med flere team
function Counter() {
const [count, setCount] = useState(0)
function increment() {
setCount(count + 1)
}
return (
<>
<span>Count is {count}</span>
<button onClick={increment}>Bump</button>
</>
);
}
@Component({
selector: 'app-counter',
templateUrl: './counter.component.html',
styleUrls: ['./counter.component.css']
})
export class CounterComponent {
count = signal(0)
increment(){
this.count.set(this.count() + 1)
}
}
<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 = $state(0)
</script>
<span>Count is {count}</span>
<button on:click={() => count++}>Bump</button>
<style>
</style>
function Counter() {
const [count, setCount] = useState(0)
function increment() {
setCount(count + 1)
}
return (
<>
<span>Count is {count}</span>
<button onClick={increment}>Bump</button>
</>
);
}
function Counter() {
const [count, setCount] = createSignal(0)
function increment() {
setCount(count() + 1)
}
return (
<>
<span>Count is {count()}</span>
<button onClick={increment}>Bump</button>
</>
);
}
class MyCounter extends LitElement {
static get properties() {
return {
count: { type: Number },
}
}
constructor() {
super()
this.count = 0
}
increment() {
this.count++
}
render() {
return html`
<span>Count is ${this.count}</span>
<button @click=${this.increment}>Bump</button>
`
}
}
@customElement('my-counter')
export class MyCounter extends LitElement {
@property()
count: number = 0
increment() {
this.count++
}
render() {
return html`
<span>Count is ${this.count}</span>
<button @click=${this.increment}>Bump</button>
`
}
}
function MyComponent(state) {
console.log('re-render')
return (
<p>Hello {state.name}</p>
);
}
function MyComponent(state) {
console.log('component created')
return (
<p>Hello {state().name}</p>
);
}
<p>Kode24-dagen {{version}}</p>
const version = 0
return html`
<p>Kode24-dagen ${this.version}</p>
`
function MyComponent() {
const version = 3
return (
<p>Kode24-dagen {version}</p>
);
}
<script>
const version = 3
</script>
<p>Kode24-dagen {version}</p>
<style></style>
{ isDay && <p>☀️</p> }
<p v-if="isDay">☀️</p>
{#if isDay}
<p>☀️</p>
{/if}
<Show when={isDay}>
<p>☀️</p>
</Show>
<ul>
{todos.map(todo =>
<li>{todo.text}</li>
)}
</ul >
<ul>
<li v-for="todo in todos">{{todo.text}}</li>
</ul>
<ul>
@for (todo of todos) {
<li>{{ todo.text }}</li>
}
</ul>
<For each={todos()}>
{todo =>
<li>{todo.text}</li>
}
</For>
const vue = ref(0)
const [solid, setSolid] = createSignal(0)
const preactOrAngular = signal(0)
const svelte = $state(0)
useState
SyntaxError: Failed to execute 'querySelector' on 'Element': '#8muez' is not a valid selector.
import { count, increment } from './store.ts'
function Counter() {
return (
<>
<span>Count is {count()}</span>
<button onClick={increment}>Bump</button>
</>
);
}
function Counter() { const [ setCount] = createSignal(0) function () { setCount(count() + 1) }
const [count, setCount] = useState(0)
useEffect(() => {
console.log(count)
}, [count])
const [count, setCount] = createSignal(0)
createEffect(() => {
console.log(count())
})
const [count, setCount] = useState(0)
setCount(count + 1)
const count = ref(0)
count.value++
const [person, setPerson] = useState({ name: 'Gaute', age: 32 })
setPerson({
...person,
age: person.age + 1,
})
const person = reactive({ name: 'Gaute', age: 32 })
person.age++
Lite endringer
Innovasjon
Popularitet gir fordeler i blant annet:
Svelte 4 (25 kB)
Angular (61 kB)
React (52 kB)
Solid (19 kB)
Svelte 5 (22 kB)
Vue (33 kB)
Preact (19 kB)
Lit (21 kB)
Svelte 4 (237 kB)
Angular (209 kB)
React (170 kB)
Solid (162 kB)
Svelte 5 (156 kB)
Vue (160 kB)
Preact (133 kB)
Lit (157 kB)
https://frontend-framework-chooser.pages.dev/
https://gaute-talks.netlify.app/choosing-the-correct-frontendframework-in-2024/index.html