users&quot;).then(function(users) {
            state.users = users
        })
    }
}

m.route(document.body, &quot;/user/list&quot;, {
    &quot;/user/list&quot;: {
        oninit: state.loadUsers,
        view: function() {
            return state.users.length &gt; 0 ? state.users.map(function(user) {
                return m(&quot;div&quot;, user.id)
            }) : &quot;loading&quot;
        }
    },
})</code></pre>
<p>In the example above, on the first render, the UI displays <code>&quot;loading&qu