Pluggable widget props visibility

I am creating a React ‘pluggable widget’ in Mendix 8.  I am passing a context object as props to the widget, however I need to do some initialisation (which would normally be done in the lifecycle method componentDidMount). The thing is, all the props seem to be undefined in this function. I.e: export class Test extends Component { componentDidMount() { const { apiHost } = this.props; console.warn(apiHost.value) // prints undefined } render() { console.warn(this.props.apiHost.value) // prints the proper value return <div>Test</div> } } How can I access the value within componentDidMount? 
3 answers

I found the answer. Each prop is an object with a ‘status’ property, which will eventually be set to ‘visible'.

So the best place for initialisation based on props (e.g. contacting a remote server) is probably in componentDidUpdate rather than componentDidMount, checking the value of ‘status’ before doing work….

It would be good if stuff like this was documented – the ‘pluggable widget’ documentation is incredibly thin….


Perhaps you could do this with async and await. This way the function would await result

async componentDidMount() {
  const response = await fetch('link');
  const json = await response.json();
  this.setState({ data: json });



Hi James,

The typings are found in

There is you can find the hint on the API 

there .status in the attribute, that can have a value: loading, unavailable, available

Reference documentation is on its way, we plan to ship when Mx8 GA is released. For now there is only the how to

Cheers, Andries