AsyncComponent
object AsyncComponent
A reusable component to renders data from a asynchronous data source, providing:
- A progress indicator when the data is being retrieved.
- Invoking the render function when the data is available, to render such data.
- Displaying an error message when retrieving the data has failed, as well as displaying a retry button so that the user is able to try again.
Type members
Classlikes
case class Props[D](fetch: () => Future[D], render: D => ReactElement, onDataLoaded: D => Unit, progressIndicator: () => ReactElement, progressIndicatorWhileReloadingData: Boolean, retryLabel: String, watchedObjects: Iterable[Any])
- Value parameters:
- fetch
the function to fetch the data
- onDataLoaded
a function invoked when the remote data has been loaded
- progressIndicator
the component rendered when the data is being loaded
- progressIndicatorWhileReloadingData
whether to display the progress indicator every time the data is being reloaded
- render
the function to render the data once it is available
- retryLabel
the label to use in the button that retries the operation
- watchedObjects
objects being watched, when any of those changes, the data is loaded again