Great job maaaan! Good to see you smiling and see that it gives you a lot of fun and enjoyment sharing your knowledge. I can't wait to use a qwik on some project. I just need to find out any :D
10:15 - what do you mean when you write that we can use listener instead of useTask? Where in the documentation did you read that? Have you tested this approach in production or is it just a hypothesis?
Hey, thank you for pointing out the missing context. What I was referring to was a section in the best practices section of the docs: qwik.dev/docs/guides/best-practices/#register-dom-events-with-useon-useonwindow-or-useondocument. It basically says that you should not misuse useVisibleTask() to register global event listeners, but instead use the listener functions to lazily load those listeners. I used it on my homepage when I started to implement parallax scrolling for my main page on js2brain.com, but I dismissed it for now :)
Another thing that comes to my mind is somewhat related to potential overuse of useEffect() in React: react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes. In the context of Qwik, in some cases, you may be tempted to update a bunch of signals when one signal changes with a task. But in some of those cases, you may be able to update the signals all at once in the triggered event handler or use a computed signal instead.
Great job maaaan! Good to see you smiling and see that it gives you a lot of fun and enjoyment sharing your knowledge. I can't wait to use a qwik on some project. I just need to find out any :D
Thanks bro! 🫶
If you don't find a project, you can still start one 😉
I did the same with my website.
10:15 - what do you mean when you write that we can use listener instead of useTask? Where in the documentation did you read that? Have you tested this approach in production or is it just a hypothesis?
Hey, thank you for pointing out the missing context. What I was referring to was a section in the best practices section of the docs: qwik.dev/docs/guides/best-practices/#register-dom-events-with-useon-useonwindow-or-useondocument.
It basically says that you should not misuse useVisibleTask() to register global event listeners, but instead use the listener functions to lazily load those listeners.
I used it on my homepage when I started to implement parallax scrolling for my main page on js2brain.com, but I dismissed it for now :)
Another thing that comes to my mind is somewhat related to potential overuse of useEffect() in React: react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes.
In the context of Qwik, in some cases, you may be tempted to update a bunch of signals when one signal changes with a task. But in some of those cases, you may be able to update the signals all at once in the triggered event handler or use a computed signal instead.