SolidJSS
SolidJS2y ago
15 replies
João Bezerra

Should I disable `solid/reactivity` linter warning in this case?

I frequently run into this warning with event handlers. Here's an example:

type PropsType = {
  something: string;
}

const SomeComponent = (props: PropsType) => {
  // eslint-plugin-solid complains with the following
  // warning:
  //
  // This function should be passed to a tracked scope
  // (like createEffect) or an event handler because it
  // contains reactivity, or else changes will be
  // ignored  solid/reactivity
  const handleInput = (value: string) => {
    print(props.something, value);
  }

  return (
    <input onClick={(event) => handleInput(event.currentTarget.value)} />
  );
}


Is there a problem with this code? If so, what's wrong with it? Otherwise, should I disable this warning in situations like this one?
Was this page helpful?