ReactTestUtils has been moved

前端 未结 4 1293
南笙
南笙 2020-12-28 17:20

I\'m starting learning React and while I was doing some tests i noticed two warning messages:

Warning: ReactTestUtils has been moved to react-dom/test-ut

4条回答
  •  一个人的身影
    2020-12-28 17:51

    I was still receiving the following warning after trying steps listed above.

    Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning.

    Updating the path in \node_modules\react-addons-test-utils\index.js solved this for me.

    Old:

    lowPriorityWarning(
      false,
      'ReactTestUtils has been moved to react-dom/test-utils. ' +
        'Update references to remove this warning.'
    );
    
    module.exports = require('react-dom/lib/ReactTestUtils');
    

    New:

    lowPriorityWarning(
      false,
      'ReactTestUtils has been moved to react-dom/test-utils. ' +
        'Update references to remove this warning.'
    );
    
    module.exports = require('react-dom/test-utils');
    

提交回复
热议问题