Custom React Hooks: Creating a simple useClock hook to display the time

Опубликовано: 12 Февраль 2026
на канале: Kostas Minaidis
52
3

Let's build a simple custom hook in React that displays the time. The hook can be re-used across different components.

We are going to learn about the importance of returning a clean up function in our useEffect to avoid processes running unnecessarily when our components using the custom hook have been unmounted.

Live demo: https://codesandbox.io/s/github/kosta...

Source code: https://github.com/kostasx/LearnJavas...

---

Support this channel

If you found this material helpful and valuable please consider supporting me:

1) Like the videos and subscribe to the YouTube channel
2) Star the GitHub repository: https://github.com/kostasx/LearnJavas...
3) Buy me a Coffee: https://www.buymeacoffee.com/kostasx
4) Follow me on Twitter:   / kostas_mns