@@ -65,7 +65,34 @@ typedef ReactDartFunctionComponentFactoryProxy FunctionComponentRegistrar(DartFu
6565/// See: <https://reactjs.org/docs/fragments.html>
6666var Fragment = ReactJsComponentFactoryProxy (React .Fragment );
6767
68- /// Suspense lets you display a fallback UI until its children have finished loading.
68+ /// [Suspense] lets you display a fallback UI until its children have finished loading.
69+ ///
70+ /// Like [react.Fragment] , [Suspense] does not render any visible UI.
71+ /// It lets you specify a loading indicator in case some components in
72+ /// the tree below it are not yet ready to render.
73+ /// [Suspense] currently works with:
74+ /// - Components that use React.lazy
75+ /// - (dynamic imports, not currently implemented in dart)
76+ ///
77+ /// Example Usage:
78+ /// ```
79+ /// render() {
80+ /// return react.div({}, [
81+ /// Header({}),
82+ /// react.Suspense({'fallback': LoadingIndicator({})}, [
83+ /// LazyBodyComponent({}),
84+ /// NotALazyComponent({})
85+ /// ]),
86+ /// Footer({}),
87+ /// ]);
88+ /// }
89+ /// ```
90+ ///
91+ /// In the above example, [Suspense] will display the `LoadingIndicator` until
92+ /// `LazyBodyComponent` is loaded. It will not display for `Header` or `Footer` .
93+ ///
94+ /// However, any "lazy" descendant components in `LazyBodyComponent` and
95+ /// `NotALazyComponent` will trigger the closest ancestor [Suspense] .
6996///
7097/// See: <https://react.dev/reference/react/Suspense>
7198var Suspense = ReactJsComponentFactoryProxy (React .Suspense );
0 commit comments