Skip to content

Commit

Permalink
add documentation on now to track useStore
Browse files Browse the repository at this point in the history
this add documentation on a case you want to track useStore and act when some of it's internal values change. 
This is added because the anonymous function expresed don't work and you need to provide the track function the object directly.
more info here
https://discord.com/channels/842438759945601056/1161720833035743272
  • Loading branch information
czuma committed Sep 18, 2024
1 parent a9ee2a6 commit a6e7bff
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ contributors:
- adamdbradley
- aendel
- jemsco
updated_at: '2023-10-18T07:33:22Z'
- czuma
updated_at: '2024-09-18T02:08:00Z'
created_at: '2023-03-31T02:40:50Z'
---

Expand Down Expand Up @@ -232,6 +233,7 @@ const delay = (time: number) => new Promise((res) => setTimeout(res, time));
> Sometimes it is required to only run code either in the server or in the client. This can be achieved by using the `isServer` and `isBrowser` booleans exported from `@builder.io/qwik/build` as shown above.
> If you want to track `useStore()` objects and execute something when any of their internal values change, use `track(myExampleStore)` directly without the anonymous function. This prevents `track()` from losing the reference to the original reactive object.
### `track()` as a function

Expand Down

0 comments on commit a6e7bff

Please sign in to comment.