Relative Content

Tag Archive for react-hooksrequirejsdynamic-programming

How can I set require() to dynamically update with an image path in React?

I have an image on my About page of a react app which i’d like the image to change to a new image every 5secs. I have set up my hooks and my aboutImg state is initially set to require(‘./img/rope.jpg’) which renders the image. But when I try to dynamically update this I get the following error for each path way I try to dynamically add: