Read public folder
Answered
Griffon Bleu de Gascogne posted this in #help-forum
Griffon Bleu de GascogneOP
Hello, i want to import multiples images from my public folder with the same css class with Next/Images can you tell me how i can read it ? I think fs and path are the solution but IDK how i can do it
Answered by Coffee Coke
you have multiple options, first is to enter your paths in the array and then map it and return image components with an array item in the src prop. You could also use import() or React.lazy() to dynamicly import images if this is what you need
2 Replies
@Griffon Bleu de Gascogne Hello, i want to import multiples images from my public folder with the same css class with Next/Images can you tell me how i can read it ? I think fs and path are the solution but IDK how i can do it
you have multiple options, first is to enter your paths in the array and then map it and return image components with an array item in the src prop. You could also use import() or React.lazy() to dynamicly import images if this is what you need
Answer
@Coffee Coke you have multiple options, first is to enter your paths in the array and then map it and return image components with an array item in the src prop. You could also use import() or React.lazy() to dynamicly import images if this is what you need
Griffon Bleu de GascogneOP
Thank you, i m going to check which one is the best for me