我使用的是react-relay/compat 1.1.0
,我需要编写一个能够上传文件的变种。 继电器经典,你可以使用getFiles()
支持文件上传突变:如何使用Relay Modern突变进行文件上传?
class AddImageMutation extends Relay.Mutation {
getMutation() {
return Relay.QL`mutation{ introduceImage }`;
}
getFiles() {
return {
file: this.props.file,
};
}
...
}
,但没有发现任何功能跟踪上传文件Relay Modern文档:
const {commitMutation} = require('react-relay');
commitMutation(
environment: Environment,
config: {
mutation: GraphQLTaggedNode,
variables: Variables,
onCompleted?: ?(response: ?Object) => void,
onError?: ?(error: Error) => void,
optimisticResponse?: ?() => Object,
optimisticUpdater?: ?(store: RecordSourceSelectorProxy) => void,
updater?: ?(store: RecordSourceSelectorProxy) => void,
configs?: Array<RelayMutationConfig>,
// files: ... ?
},
);
的是,在被支持接力现代?如果是这样,那么做什么方式?谢谢。