2017-02-17 4 views
1

방법은반응 소품을 통해 Apollo 쿼리 선택을 전달하는 방법이 있습니까? 아폴로 데이터를 채우기 위해 호출 반응

graphql(withQLTag)(ReactComponent) 

구성 요소 클래스 외부에 존재 소품.

그러나 여러 데이터 모델에 대해 목록을 다시 사용할 수 있도록 미리 정의 된 쿼리에 의해 반응 소품을 통해 사용하는 데이터를 제어하려면 어떻게해야합니까? (목록보기는 모두에있는 속성 데이터가 반환 됨)

render() { 
     return(
      <ReactComponent qlTag="Model1"> 
     )... 

이 방법을 사용할 수 있습니까?

답변

1

원하는만큼 포장 구성 요소를 만들 수 있습니다 다음 graphql 래퍼의

import MyListComponent from './somewhere'; 

const ProductListComponent = graphql(ProductListQuery)(MyListComponent) 
const EventListComponent = graphql(EventListQuery)(MyListComponent) 
const SomethingElseListComponent = graphql(SomethingElseListQuery)(MyListComponent) 

생각해을 같은 그냥 소품에 전달하는 구성 요소를 생성.