retrieve attribute from props

0
Hi, I’m having some issue when trying to get an entity attribute inside my Pluggable Web Widget. Every time I try to log or use the attribute console.info(this.props.config); It keeps giving me this object that seems to be in ‘loading’ state this is the xml part <propertyGroup caption="Data source"> <property key="dataEntity" type="attribute"> <caption>Attribute (path)</caption> <description/> <attributeTypes> <attributeType name="String"/> </attributeTypes> </property> </propertyGroup> I am passing the data like this in my webmodeler config={this.props.dataEntity} This is the interface  export interface InputProps { config?: string | any; }  
asked
1 answers
0

I found a way to resolve the problem.

you should use componentWillReceiveProps, it will wait for the props to before rendering

 

componentWillReceiveProps(props: any) {
        if (props.config.value !== "") {
           //set here the sate
        }

}

 

answered