Skip to content

Instantly share code, notes, and snippets.

@Faliszek
Created July 26, 2018 21:50
Show Gist options
  • Save Faliszek/dc5910bc74544a72d8d9908fd52d7251 to your computer and use it in GitHub Desktop.
Save Faliszek/dc5910bc74544a72d8d9908fd52d7251 to your computer and use it in GitHub Desktop.
export const CampaignCreator = graphql(gql`
mutation singleUpload($file: MyUpload!, $name: String) {
singleUpload(file: $file, name: $name) {
id
path
}
}
`)(({ mutate }) => (
<input
type="file"
required
onChange={({
target: {
validity,
files: [file]
}
}) => validity.valid && mutate({ variables: { file, name: file.name } })}
/>
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment