reactjs - how to use `subscribeToMore` with `apolloClient.query()` -
i'm building react-native application , using sagas/redux. in 1 of components, i'm dispatching function fetch messages , update store (i'm not sure if practice, thoughts?)
export function* messagesearch({ filter }) { const res = yield call(() => apolloclient.query({ query: gql` query($filter: json) { messages:messagesearch(filter: $filter) { id time text fromid attachment } } `, fetchpolicy: 'network-only', variables: { filter } })) if (res.data && res.data.messages) { yield put(conversationactions.messagesearchsuccess(res.data.messages)) } else { yield put(conversationactions.messagesearchfailure('wrong')) } } the question how use subscribetomore pattern subscription new data without wrapping component graphql(gql'query { ... }')(mycomponent) , use data.subscribetomore
Comments
Post a Comment