从React组件触发graphql查询

时间:2019-09-11 07:13:56

标签: reactjs graphql

Container- container / ReviewPage.js

import ReviewPage from '../components/ReviewPage.jsx'

const Container = compose(
graphql(ALL_TABLE_CELLS_BY_PAGE_ID,{
    name: 'tableCellsforPage',
     options: ownProps => ({
       fetchPolicy: 'network-only',
       variables: { pageId: ??? }
     }),
     props: ({ data }) => {
     tableCells = data.allTableCellsByTableId.nodes
     }
   })
)(ReviewPage)

export default Container

Component- components / ReviewPage.jsx

  handleCheckMarkClick(page){
    const cells = this.props.tableCellsforPage(page.id)
  }

我要解雇this.props.tableCellsforPage(page.id) 鉴于我正在传递page.id,如何读取variables: { pageId: ??? }

0 个答案:

没有答案