'Serving static files from Express server

I have an Express server that contains a public folder containing 5 images. I want to load those images inside of my ReactJS app. How would I do that?

I'm already using:

app.use("/static", express.static(path.join(__dirname, "public")));

and I can access them when I manually type in the URL, but I'm unable to figure out how to serve them all in my React app.

Any help would be much appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source