React Enzyme find second (or nth) node
问题 I'm testing a React component with Jasmine Enzyme shallow rendering. Simplified here for the purposes of this question... function MyOuterComponent() { return ( <div> ... <MyInnerComponent title="Hello" /> ... <MyInnerComponent title="Good-bye" /> ... </div> ) } MyOuterComponent has 2 instances of MyInnerComponent and I'd like to test the props on each one. The first one I know how to test. I use find with first ... expect(component.find('MyInnerComponent').first()).toHaveProp('title', 'Hello