I want to build a simple routing where my Table component receives the fragment Table_table:
routing.js
const tableQuery = graphql`
query routesTableQuery($tableId: String){
store {
table(id: $tableId){
name
stake
}
}}
`
<Route
path="table"
Component={Table}
prepareVariables={params => ({tableId: '59abf1a01710ba3b74718220'})}
query={tableQuery}
/>
Table.js container
export default createFragmentContainer(
Table,
graphql`
fragment Table_table on Table {
name
stake
}
)`
But instead of receiving table prop in the component, I'm receiving store (and table prop is null). Also if I set ...Table_table instead of specific fields inside the query, I'm getting an error "Expected prop table
to be supplied to Relay(Table)
, but got undefined
" Any thoughts why?
I managed it by using render attribute in the routing.