YearinKim / test

0 stars 0 forks source link

Svelte #2

Open YearinKim opened 1 year ago

YearinKim commented 1 year ago
image



Svelte란



The State of JS 2021 Web Frontend Framework

image

React Vue Angular Svelte
만족도 2 3 4 1
관심도 3 2 4 1
사용량 1 3 2 4
인지도 1 2 3 4



Svelte의 특징

image


Write less code

Build boilerplate-free components using languages you already know

HTML, CSS and JavaScript.

image image
<!--Svelte-->
<script>
  let a = 1;
  let b = 2;
</script>

<input type="number" bind:value={a}>
<input type="number" bind:value={b}>

<p>{a} + {b} = {a + b}</p>


-- React
import React, { useState } from 'react';

export default () => {
  const [a, setA] = useState(1);
  const [b, setB] = useState(2);

  function handleChangeA(event) {
    setA(+event.target.value);
  }

  function handleChangeB(event) {
    setB(+event.target.value);
  }

  return (
    <div>
      <input type="number" value={a} onChange={handleChangeA}/>
      <input type="number" value={b} onChange={handleChangeB}/>

      <p>{a} + {b} = {a + b}</p>
    </div>
  );
};


<!--Vue-->
<template>
  <div>
    <input type="number" v-model.number="a">
    <input type="number" v-model.number="b">

    <p>{{a}} + {{b}} = {{a + b}}</p>
  </div>
</template>

<script>
  export default {
    data: function() {
      return {
        a: 1,
        b: 2
      };
    }
  };
</script>


No Virtual DOM

Svelte compiles your code to tiny, framework-less vanilla JS.

your app starts fast and stays fast

image


Truly reactive

No more complex state management libraries

Svelte brings reactivity to JavaScript itself


단점



마치며,,,

YearinKim commented 1 year ago

https://heropy.blog/2019/09/29/svelte/