How to deploy react images inside a wordpress plugin?

admin

Administrator
Staff member
I developed some small wordpress plugin in react. The react app is using some images inside the project. When i deployed the react app the URL of the images (assets) becomes automatically

Code:
wordpress.local/static/media/ArrowLeft.529a61df.svg

which cannot be found in the wordpress project. (I didn't forget to import the images)

I know i can upload the images in wordpress and copy the media folder path into my local react project but then i won't see the images in my react app. Any workarounds to do it this way and display the images inside the local react app seems to be too dirty for me.

I am including the image in react like this:

<pre class="lang-js prettyprint-override">
Code:
import ArrowLeft from "../media/arrowleft.svg"

and use it like that:

Code:
&lt;img src={ArrowLeft} alt='arrow-left' className='arrow-left'/&gt;

So is there a way to include the images this way and make them appear in wordpress right after importing the react code with images? If not, any ideas what would be a good way of achieving the images being displayed in wordpress?