Skip to content

Question: What's a tracked scope? #8

Description

@imedadel

Hello Josh! I'm enjoying this ESLint plugin, however, I'm having trouble understanding the meaning of a tracked scope and the examples aren't quite answering my question. In my case, I wanted to pass a prop to a custom hook/function but I'm getting either The reactive variable 'localRef' should be used within a tracked scope or This function should be passed to a tracked scope because it contains reactivity.

Example:

const Component = (props) => {
  const [local, rest] = splitProps(props, ["ref"]);
  const localRef = () => local.ref;
  const composedRef1 = useComposedRefs(localRef); // error: The reactive variable 'localRef' should be used within a tracked scope
  const composedRef2 = useComposedRefs(() => local.ref); // error: This function should be passed to a tracked scope because it contains reactivity.
	// ...
}

What am I missing? 😩

And, sorry if this is not the right place to ask!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions