# useTask$()
> * 如有錯誤處指正或任何建議,懇請留言,感謝!
> * 搭配 ChatGPT 進行翻譯,請小心服用
> * ▸ ... 為英文原文
:::spoiler ...
Use [`useTask$()`](https://qwik.builder.io/docs/components/lifecycle/#usetask) to execute a function before the initial render and whenever the tracking values change. The function executes before rendering, but it can't delay rendering, so if [`useTask$()`](https://qwik.builder.io/docs/components/lifecycle/#usetask) is asynchronous, the rendering will happen before the [`useTask$()`](https://qwik.builder.io/docs/components/lifecycle/#usetask) is fully executed.
## Tracking store changes
The [`useTask$()`](https://qwik.builder.io/docs/components/lifecycle/#usetask) hook receives a `track()` function used for setting up subscriptions that will automatically rerun the [`useTask$()`](https://qwik.builder.io/docs/components/lifecycle/#usetask) hook. The set of `track()` properties resets on each [`useTask$()`](https://qwik.builder.io/docs/components/lifecycle/#usetask) execution, therefore it is important to always use `track()` to set up subscriptions anew. Because of this it is possible for the [`useTask$()`](https://qwik.builder.io/docs/components/lifecycle/#usetask) to subscribe to different properties over time.
## Cleanup
The [`useTask$()`](https://qwik.builder.io/docs/components/lifecycle/#usetask) hook can return a cleanup callback. This is useful for cleaning up any resources before new execution.
:::
###### tags: `Lifecycle Hooks`