How to add resources ( images/svg) in pluggable widget

0
I am developing custom pluggable (web) widget using ReactJS. I want to add certain static resource( images/svg) in my widget. I am not able to figure out how the render method should refer to these static resource. e.g. I copied a test.png file in src\ui folder of widget code, and tried adding img tag in render method as below   render() {         return (          <div> this is my div                    <img src="../ui/test.png" /></div>         ); But when I add this widget in mendix app, image is not visible.   In the mendix app image path is shown as http://localhost:8080/ui/test.png  
asked
1 answers
0

Hi Milind Barve,
https://docs.mendix.com/apidocs-mxsdk/apidocs/property-types-pluggable-widgets
can refer this link mendix provides a component type Image
https://docs.mendix.com/apidocs-mxsdk/apidocs/client-apis-for-pluggable-widgets#imagevalue

export interface WebImage {
    readonly uri: string;
    readonly name: string;
    readonly altText?: string;
}
export type NativeImage = Readonly<ImageURISource & { name?: string; } | string | number>;
export type ImageValue = WebImage | NativeImage;

hope this helps you 

cheers,
Narendran 

answered