---
title: "Comment by René Monroy on \"3 reasons you should try Svelte\" | Hashnode"
description: "I like Svelte but that code comparison is kinda staged. A fair one would use hooks on React, also would properly clear the interval in Svelte too and used the c"
url: "https://hashnode.com/posts/3-reasons-you-should-try-svelte/5f6b5e26ff06f53c8bd635bc/comment/5f6b91a861f6923cac7c04b3"
---

[Discussion](https://hashnode.com/posts/3-reasons-you-should-try-svelte/5f6b5e26ff06f53c8bd635bc)

Comment [3 reasons you should try Svelte](https://hashnode.com/posts/3-reasons-you-should-try-svelte/5f6b5e26ff06f53c8bd635bc)

[René Monroy](https://hashnode.com/@rene)

[Sep 23, 2020](https://hashnode.com/posts/3-reasons-you-should-try-svelte/5f6b5e26ff06f53c8bd635bc/comment/5f6b91a861f6923cac7c04b3)

I like Svelte but that code comparison is kinda staged. A fair one would use hooks on React, also would properly clear the interval in Svelte too and used the component created inside other component as well.

For React can be done this way (and clearing the interval):

```
function Timer() {
  const [seconds, setSeconds] = useState(0);

  useEffect(() => {
    const interval = setInterval(() => {
      setSeconds(seconds + 1);
    }, 1000);
    return () => clearInterval(interval);
  });

  return <span>Seconds: {seconds}</span>;
}
```

Either way, Svelte is really nice and I'd recommend it every day.

[Ameen](https://hashnode.com/@Coder_Crafter)

[Sep 23, 2020](https://hashnode.com/posts/3-reasons-you-should-try-svelte/5f6b5e26ff06f53c8bd635bc/comment/5f6b91a861f6923cac7c04b3#reply-5f6bb3c7136a1642fa93ac8b)

Sorry used the example on React's official site , will keep this in mind. Thanks for informing 🙂
