score:0
so my issue is that i do not know how a user can download all the images by clicking on a link.
given that scenario, i would recommend avoiding the link
component, since doesn't fit your requirements.
i would do something like:
<button onclick={downloadallitems}>download</button>
then, in your function:
const downloadallitems=()=>{
data.allstrapilogos.nodes.foreach(node=> window.open(`/yoursite.com/${node.image.localfile.publicurl}`))
}
modified from:
- how can i let a user download multiple files when a button is clicked?
- how to make a link open multiple pages when clicked
add an event.preventdefault
before the loop if the button is inside a form to avoid unwanted requests if needed.
given your use-case, i think is the more intuitive approach to download all items in one-click function.
you can bypass browser's (or adblock's) limitation by setting the window.open
and save the memory reference and setting the location on the callback:
let newwindow=window.open(...)
then:
newwindow.location=`/yoursite.com/${node.image.localfile.publicurl}`
Source: stackoverflow.com
Related Query
- Gatsby GraphQL download multiple images at once
- Gatsby GraphQL query for multiple images
- Can't get {data.allFile.edges.map(({ node }) to render multiple images with Gatsby + GraphQL
- Query multiple JSON files with graphQL in Gatsby
- Gatsby & GraphQL - render a download link from a queried file
- Multiple background images in Gatsby using linear gradient
- Get all images from specific directory via GraphQL and Gatsby JS
- Gatsby - Get multiple images from an array in a Markdown file
- Mapping Gatsby gallery images with GraphQL
- How do you query and display a folder of multiple images using GatsbyJS and GraphQL
- How to source data from multiple directories(file-system) in gatsby using graphQL
- How to upload multiple images at once in react Node
- Importing and displaying multiple images from GraphQL using gatsby-plugin-image
- Uploading Multiple Images to Firebase Storage, and Then Calling the Download URL's to Firebase Database
- gatsby with multiple versions of graphql - yarn resolutions
- Multiple images in a row on Gatsby / Markdown?
- How do I query multiple images with gatsby-image?
- Querying all images in folder using GraphQL
- how to update multiple state at once using react hook react.js
- How to give Gatsby a GraphQL schema
- Gatsby and Graphql - How to filter allMarkdownRemark by folder
- How to create multiple pages from single json files in Gatsby
- Uncaught TypeError: Cannot read property 'data' of undefined with Gatsby and graphQl
- How to set multiple values at once in react hook form using Typescript
- run response interceptor only once when multiple API calls
- Multiple installations of Global site tag (gtag.js) detected in Gatsby application
- Typescript and React (with Gatsby loader): unable to import images as modules
- GraphQL query works in Gatsby page but not inside class component
- How to avoid "Excessive number of pending callbacks: 501" error during images download in React Native?
- Gatsby JS - Multiple pages pulling in markdown files with different categorys
More Query from same tag
- How to resolve "InvalidStateError" in React?
- Conditional rendering does not wait for axios data fetch
- ReactTransitionGroup animation not playing on state change
- Semantic react ui dropdown multiple selection: option to Select All
- reactJs : Communication between two different components
- React import package get Support for the experimental syntax 'jsx' isn't currently enabled
- How can I Inject jQuery tooltip code into React via NPM or Hook?
- Why does adding a space in tag register the node as Comment_Node
- How to set -webkit-overflow-scrolling inline style on react component
- Programmatically Navigating React Router V6 From React.Componet
- How do you use FontAwsome Icons in Hyperstack?
- Constructor props state vs simply state
- importing functional component and getting Element type is invalid
- Material UI MuiTheme Modification
- Can we set state of react component in worker thread?
- how to control data while returning to react app?
- Convert Dome javascript Object to react element
- Chart js 2 bars with one customize label on top
- How to compile JSX server side
- How do you apply styling to array from a markdown file for Gatsby built website?
- Redux + React + Typescript: How can I reduce the amount of scaffolding required?
- How to style the border of a MUI outlined TextField?
- Convert this JS snippet to React
- React Get second object if id is equals with another object id
- Typescript interface declaration for form event
- Creating a loading timeout page in React
- Using D3, how to iterate over a non-uniform matrix (of categories) and draw rectangles based on category-color map?
- Can $regex and $gte/$lte for strings in mongodb be used together?
- Is there a way adding Freshworks chat widget to a website built on Gatsby?
- setState causing infinite loop in custom hook