From dbd0a85dd76edf5221b6ee1fc9cf98c9c46186a9 Mon Sep 17 00:00:00 2001 From: Stanislav Date: Wed, 3 Jan 2024 18:50:10 +0400 Subject: [PATCH] Docs: broken links to react bindings API and (#80) * [docs] Missing deps array for useComputed * [docs] broken links to react bindings API * use pnpm to run auto * just pnpm auto * remove -- --------- Co-authored-by: David Sheldrick --- .github/workflows/enforce-label.yml | 2 +- docs/docs/react-bindings.mdx | 6 +++--- packages/signia-react/src/useComputed.ts | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/enforce-label.yml b/.github/workflows/enforce-label.yml index 39a4863..2939cf4 100644 --- a/.github/workflows/enforce-label.yml +++ b/.github/workflows/enforce-label.yml @@ -27,7 +27,7 @@ jobs: - uses: 8BitJonny/gh-get-current-pr@2.2.0 id: PR - - run: yarn auto pr-check --pr $PR --url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" + - run: pnpm auto pr-check --pr $PR --url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" env: PR: ${{ steps.PR.outputs.number }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/docs/react-bindings.mdx b/docs/docs/react-bindings.mdx index 6d30f32..56e6118 100644 --- a/docs/docs/react-bindings.mdx +++ b/docs/docs/react-bindings.mdx @@ -11,9 +11,9 @@ We provide officially-supported React bindings for `signia` in two packages: - `signia-react` provides hooks for creating and consuming signals in functional components. - [`useAtom`](API/signia_react/functions/useAtom) - A hook for creating atomic signals. - - [`useComputed`](API/signia_react/functions/useAtom) - A hook for creating computed signals. - - [`track`](API/signia_react/functions/useAtom) - component wrapper for automatically tracking signal value access and re-rendering the wrapped component if the signals' values change. - - [`useValue`](API/signia_react/functions/useAtom) - A hook for manually tracking signal value access (not required if you use `track`) + - [`useComputed`](API/signia_react/functions/useComputed) - A hook for creating computed signals. + - [`track`](API/signia_react/functions/track) - component wrapper for automatically tracking signal value access and re-rendering the wrapped component if the signals' values change. + - [`useValue`](API/signia_react/functions/useValue) - A hook for manually tracking signal value access (not required if you use `track`) - `signia-react-jsx` provides a minimal global jsx integration for use with TypeScript's `jsxImportSource` option. This causes all functional components to be automatically tracked. It does not provide any automatic unpacking (i.e. dereferencing) of signal values. diff --git a/packages/signia-react/src/useComputed.ts b/packages/signia-react/src/useComputed.ts index 226e4cd..4b6ad09 100644 --- a/packages/signia-react/src/useComputed.ts +++ b/packages/signia-react/src/useComputed.ts @@ -15,7 +15,10 @@ import { Computed, computed, ComputedOptions } from 'signia' * } * * const Greeter = track(function Greeter ({firstName, lastName}: GreeterProps) { - * const fullName = useComputed('fullName', () => `${firstName.value} ${lastName.value}`) + * const fullName = useComputed('fullName', () => `${firstName.value} ${lastName.value}`, [ + * firstName, + * lastName, + * ]) * return
Hello {fullName.value}!
* }) * ```