最佳答案
在发布这个问题之前,我尝试在 sqa stackexchange 中搜索,但是没有找到关于肤浅和渲染的帖子,所以我希望有人可以帮助我。
什么时候我应该使用浅层渲染测试反应组件? 根据 Airbnb 的文档,我对两者的区别提出了一些看法:
因为肤浅是测试组件 作为一个整体,所以它应该用于“父”组件(例如,表、包装器等)
渲染是针对子组件的。
我之所以问这个问题,是因为我不知道该用哪一种(尽管医生说它们非常相似)
那么,我如何知道在特定的场景中使用哪一个呢?