Выдает варнинг в консоль: Line 14:6: React Hook React.useEffect has a missing dependency: 'dispatch'. Either include it or remove the dependency array react-hooks/exhaustive-deps. Зачем меня просят установить dispatch в зависимость useEffect?
import * as React from 'react'
import css from './List.module.css';
import Note from '../Note/Note'
import { useDispatch, useSelector } from 'react-redux'
import { setTotal } from '../../Redux/actions/note'
export const List = () => {
const notes = useSelector(({ note }) => note.items)
const dispatch = useDispatch()
React.useEffect(() => {
dispatch(setTotal(notes.length))
}, [notes])
return (
<>
<ul className={css.list}>
{notes && notes.map((note, i) => <Note i={i} key={`key_${i}`} text={note}/>)}
</ul>
</>
)
}
export default List;