如何在ReactJ中使用MAP函数编写渲染动态子组件的单元测试(React Testing库)
我的数组中有一些问题列表。在该数组中,有问题,选项,类型,ID。 我正在渲染组件并使用地图功能迭代数组。如果数组找到了“无线电”类型,则我在父级和通过道具中渲染另一个组件radiotypecont。同样,如果类型是“ text”,我正在渲染textTypeceponent,...等。 有人可以让我知道如何使用React测试库为此方案编写单元测试吗?
谢谢!
I have a list of questions in my array. Inside that array, there are questions, options, type, id.
I am rendering a component and using map function to iterate the array. If array has found type 'Radio', I'm rendering another component Radiotypecomponent in parent one and passing props. Similarly, if type is "text" I'm rendering Texttypecomponent, ...etc.
Can someone please let me know how to write unit test for this scenario using react testing library?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论