score:1

dispatch should not change, it's the dispatch function provided from the redux store. the react hook linter just sees it as a function, however, and is warning you it can be mutated. i think you've a syntax error though, missing parens. i think it should be

useeffect(() => () => dispatch(setvalue()), []);

you can ignore the rule for that line though, if necessary

// eslint-disable-next-line react-hooks/exhaustive-deps

usage

// eslint-disable-next-line react-hooks/exhaustive-deps
useeffect(() => () => dispatch(setvalue()), []);

or (imo a bit easier to read)

useeffect(() => {
  return () => dispatch(setvalue());
  // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Related Query

More Query from same tag