Support dynamic data loading on UIElement mount

Author: tserdeiroCreated Mar 25, 2026Updated Sep 21, 2026

Hi everyone,

I’m trying to define, from JSON, that a component should call an external API when it mounts in order to populate its state, but I haven’t found a way to do it.

Could you please confirm whether this is currently supported, and if so, what the recommended approach would be?

For example:

json
{
  "root": "username",
  "elements": {
    "username": {
      "type": "Text",
      "props": { "content": { "$state": "/user/name" } },
      "children": []
    }
  },
  "state": {
    "user": undefined
  },
  "on": {
    "mount": [
      { "action": "fetchUser" }
    ]
  }
}

The idea is that fetchUser would internally perform a fetch request, retrieve the user data, and then update the component state accordingly.

Is this currently possible? If not, is there an alternative or recommended pattern to achieve this behavior?