Read public folder
Answered
RPIMa FullGreen posted this in #help-forum
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
@RPIMa FullGreen 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
Thank you, i m going to check which one is the best for me