Comment by bossyTeacher
6 hours 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} />
No one's going to mention VueJS?