top | item 46668903

(no title)

mehagar | 1 month ago

How is it overly verbose?

I find it very intuitive, with the exception of useEffect.

discuss

order

spartanatreyu|1 month ago

React's hello world:

```js

<div id="root"></div>

<script>

import React from 'https://esm.sh/react@19';

import ReactDOM from 'https://esm.sh/react-dom@19/client';

const root = ReactDOM.createRoot(document.getElementById('root'));

root.render(<h1>Hello, world!</h1>); </script>

```

---

HTML's hello world:

```html

<h1>Hello, world!</h1>

```

---

JS's hello world:

Nothing, it was already done in HTML

bossyTeacher|1 month ago

React:

import { useState } from "react";

function Counter() { const [count, setCount] = useState(0);

  return (
    <button onClick={() => setCount(count + 1)}>
      Count: {count}
    </button>
  );
}

---------- Svelte:

<script> let count = 0; </script>

<button on:click={() => count += 1}> Count: {count} </button> --------------- React: function Editor({ initialText }) { const [text, setText] = useState(initialText);

  useEffect(() => {
    setText(initialText);
  }, [initialText]);

  return (
    <textarea
      value={text}
      onChange={e => setText(e.target.value)}
    />
  );
} --------------------- Svelte:

<script> export let initialText; let text = initialText;

  $: text = initialText;
</script>

<textarea bind:value={text} />

DaanDL|1 month ago

No one's going to mention VueJS?

division_by_0|1 month ago

Seeing Svelte 3/4 code always warms my heart. The ergonomics of `$:` are amazing.