2017-01-06 2 views
2

불변 위반 : 컨텍스트 또는 "Connect (IndexResult)"의 소품에 "store"를 찾을 수 없습니다. 루트 구성 요소를 랩핑하거나 명시 적으로 "상점 (Store)"을 "Connect (IndexResult)"의 소품으로 전달하십시오. 내가 = 마운트()Reux Redux Unit 테스트 케이스

CONST 래퍼를 마운트 사용하려고하면

이 오류를 얻기;

+0

이보기에 더 많은 코드를 구성 요소를

export const wrapIntoReduxProvider = testingContainerComponent => ( <Provider store={organizationStore({})}> {testingContainerComponent} </Provider> ); 

및 포장 [요청하는 방법 (http://stackoverflow.com/help/how-to- 질문 : –

답변

1

이 기능 만들기 : 그것은

const wrapper = mount(wrapIntoReduxProvider(<YourComponent />)); 
+0

더 높은 주문 구성 요소 솔루션 인 –

+0

에 대해 +1을 더했으나 이제 구성 요소의 상태 변수에 액세스 할 수 없습니다. 그것은 null이다. – kushal