You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Defer loading a component's code until it is rendered for the first time.
281
-
///
282
-
/// The `lazy` function is used to create lazy components in react-dart. Lazy components are able to run asynchronous code only when they are trying to be rendered for the first time, allowing for deferred loading of the component's code.
283
-
///
284
-
/// To use the `lazy` function, you need to wrap the lazy component with a `Suspense` component. The `Suspense` component allows you to specify what should be displayed while the lazy component is loading, such as a loading spinner or a placeholder.
285
-
///
286
-
/// Example usage:
287
-
/// ```dart
288
-
/// import 'package:react/react.dart' show lazy, Suspense;
289
-
/// import './simple_component.dart' deferred as simple;
290
-
///
291
-
/// final lazyComponent = lazy(() async {
292
-
/// await simple.loadLibrary();
293
-
/// return simple.SimpleComponent;
294
-
/// });
295
-
///
296
-
/// // Wrap the lazy component with Suspense
297
-
/// final app = Suspense(
298
-
/// {
299
-
/// fallback: 'Loading...',
300
-
/// },
301
-
/// lazyComponent({}),
302
-
/// );
303
-
/// ```
304
-
///
305
-
/// Defer loading a component’s code until it is rendered for the first time.
306
-
///
307
-
/// Lazy components need to be wrapped with `Suspense` to render.
308
-
/// `Suspense` also allows you to specify what should be displayed while the lazy component is loading.
/// Defer loading a component's code until it is rendered for the first time.
11
+
///
12
+
/// The `lazy` function is used to create lazy components in react-dart. Lazy components are able to run asynchronous code only when they are trying to be rendered for the first time, allowing for deferred loading of the component's code.
13
+
///
14
+
/// To use the `lazy` function, you need to wrap the lazy component with a `Suspense` component. The `Suspense` component allows you to specify what should be displayed while the lazy component is loading, such as a loading spinner or a placeholder.
15
+
///
16
+
/// Example usage:
17
+
/// ```dart
18
+
/// import 'package:react/react.dart' show lazy, Suspense;
19
+
/// import './simple_component.dart' deferred as simple;
20
+
///
21
+
/// final lazyComponent = lazy(() async {
22
+
/// await simple.loadLibrary();
23
+
/// return simple.SimpleComponent;
24
+
/// });
25
+
///
26
+
/// // Wrap the lazy component with Suspense
27
+
/// final app = Suspense(
28
+
/// {
29
+
/// fallback: 'Loading...',
30
+
/// },
31
+
/// lazyComponent({}),
32
+
/// );
33
+
/// ```
34
+
///
35
+
/// Defer loading a component’s code until it is rendered for the first time.
36
+
///
37
+
/// Lazy components need to be wrapped with `Suspense` to render.
38
+
/// `Suspense` also allows you to specify what should be displayed while the lazy component is loading.
0 commit comments