reactjs - Relay container with no data -
i'm building app first real foray react, relay , graphql, using relay modern.
the basic case is, have login form component doesn't need data; say, component renders form, , has corresponding mutation, doesn't need query anything.
it seems providing relay style query fragment necessity when calling createfragmentcontainer
, in turn ensures this.props.relay
not null
in context of component.
right now, i'm using standard (non-relay) react component login form, result i'm unable access relay environment pass through mutation.
my question - there way pass "empty" relay fragment? or there better idiom recommended in case?
you use normal component create mutation file mutation in it. run relay compiler create graphql fragment mutation , call on mutation in form submit. mutation need environment. here relay modern docs:
https://facebook.github.io/relay/docs/mutations.html
you need store result of mutation somewhere , append auth token next requests, shouldn't terribly hard do. oncompleted , store result somewhere.
your environment should seperate file import mutations , query renders. paginationcontainer inherits encironment queryrenderer.
wiki
Comments
Post a Comment