Skip to content

Commit b05ca29

Browse files
authored
Update untrack.mdx example
"const value = untrack(() => props.value)" is not a recommended pattern especially because the same could be achieved with "const value = props.value" which is also not a recommended pattern as shown in the following link -> https://docs.solidjs.com/concepts/components/props#destructuring-props.
1 parent 9b39632 commit b05ca29

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/routes/reference/reactive-utilities/untrack.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ description: >-
1818

1919
Ignores tracking any of the dependencies in the executing code block and returns the value. This helper is useful when a certain `prop` will never update and thus it is ok to use it outside of the tracking scope.
2020

21-
```tsx title="component.tsx"
21+
```tsx title="component.tsx" {4}
2222
import { untrack } from "solid-js";
2323

2424
export function Component(props) {
25-
const value = untrack(() => props.value);
26-
27-
return <div>{value}</div>;
25+
return <div>{untrack(() => props.value)}</div>;
2826
}
2927
```
3028

0 commit comments

Comments
 (0)