Error react-hook-form TypeError: target.addObserver is not a function

Error react-hook-form TypeError: target.addObserver is not a function

当我使用 react-hook-form 创建一个 React 应用程序 (create-react-app) 并向其添加 xmldom-ts 时,它导致我出现以下错误

TypeError: target.addObserver is not a function MutationObserverImpl.observe

附上重现问题的Codesanbox https://codesandbox.io/s/zealous-perlman-bdkot?file=/src/App.js

如果有人能指导我如何解决,非常感谢

您的错误似乎与 react-hook-form 没有任何关系,而是与提供自己的 MutationObserver 实现的 xmldom-ts 有关,当 react-hook-form 尝试使用它时它会爆炸。显然 xmldom-ts 已经 3 岁了,那里一定有更现代(和工作)的东西。