ApiResponseView - Manual loading

See the ApiResponseView - Standard use page for more information on the component, or the source code for this page.

Sometimes you want to handle loading the data yourself, so you can't rely on the ApiResponseView to know when loading has finished, nor when an error occurs. In these cases, you need to wire up a little more code.

OK, so not that much actually! All you need to do is set the ManualLoading property of the ApiResponseView to true, and use the Do method to load your code. In the callback lambda, return a new ApiResponse with a state of Success and the required data.

In this sample, we have also overridden the default values for the loader. As with all of the RenderFragment properties in the component, this can be done on a global or individual level. See the ApiResponseView - Standard usage page for details.

See the source code for this page to see how the example below is done.

This is the Success component, which will be shown when the manual loading has completed.
The winning number is... 0
Hang on, we'll be there soon...
An error has occurred. This application may no longer respond until reloaded. Reload 🗙