Skip to content

Commit

Permalink
Merge pull request #37 from udecode/changeset-release/main
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens authored Apr 22, 2022
2 parents 340618e + 2ca681f commit 864c22b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 34 deletions.
33 changes: 0 additions & 33 deletions .changeset/witty-games-raise.md

This file was deleted.

34 changes: 34 additions & 0 deletions packages/zustood/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# @udecode/zustood

## 1.1.0

### Minor Changes

- [#36](https://github.com/udecode/zustood/pull/36) [`c66963c`](https://github.com/udecode/zustood/commit/c66963c6fd56ec91d2d658421499a701742bfb69) Thanks [@ShinyLeee](https://github.com/ShinyLeee)! - `react-tracked` support

Use the tracked hooks in React components, no providers needed. Select your
state and the component will trigger re-renders only if the **accessed property** is changed. Use the `useTracked` method:

```tsx
// Global tracked hook selectors
export const useTrackedStore = () => mapValuesKey('useTracked', rootStore);

// with useTrackStore UserEmail Component will only re-render when accessed property owner.email changed
const UserEmail = () => {
const owner = useTrackedStore().repo.owner();
return (
<div>
<span>User Email: {owner.email}</span>
</div>
);
};
// with useStore UserEmail Component re-render when owner changed, but you can pass equalityFn to avoid it.
const UserEmail = () => {
const owner = useStore().repo.owner();
// const owner = useStore().repo.owner((prev, next) => prev.owner.email === next.owner.email)
return (
<div>
<span>User Email: {owner.email}</span>
</div>
);
};
```

## 1.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/zustood/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@udecode/zustood",
"version": "1.0.0",
"version": "1.1.0",
"description": "A modular store factory using zustand",
"keywords": [
"zustand"
Expand Down

0 comments on commit 864c22b

Please sign in to comment.