React 17 changes the way references are handled for unmounted components. They are cleared right after the component is unmounted, but the effect unmount function is called later on. This means that references values must be stored in a local variable other wise they are undefined.
https://it.reactjs.org/blog/2020/08/10/react-v17-rc.html#potential-issues
This lines breaks on React 17.
https://github.com/Kiarash-Z/react-modern-calendar-datepicker/blob/0cd7478b2fda3f755f0128a2ba1244346ed9eba0/src/Calendar.js#L47
React 17 changes the way references are handled for unmounted components. They are cleared right after the component is unmounted, but the effect unmount function is called later on. This means that references values must be stored in a local variable other wise they are undefined. https://it.reactjs.org/blog/2020/08/10/react-v17-rc.html#potential-issues
That portion of code should be rewritten as