Skip to content

Commit

Permalink
Rewrite loading paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
smnandre committed Mar 6, 2024
1 parent 4839947 commit 0ac7329
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/LiveComponent/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2259,21 +2259,17 @@ Deferring / Lazy Loading Components
-----------------------------------

When a page loads, all components are rendered immediately. If a component is
heavy to render, you can defer its rendering after the page has loaded.

Moreover, some components are not needed until the user scrolls to them (like
components at the bottom of a long page like comments, related products, etc.).
In this case, you can load them "lazily" when they are in the viewport.

By loading a component asynchronously, the page will load faster and the user
will be able to interact with it sooner, improving both the user experience
and the overall performance of your application.
heavy to render, you can defer its rendering until after the page has loaded.
This is done by making an Ajax call to load the component's real content either
as soon as the page loads (``defer``) or when the component becomes visible
(``lazy``).

.. note::

Behind the scenes, your component *is* created & mounted during the initial
page load, but its template isn't rendered. So keep your heavy work to methods in
your component (e.g. ``getProducts()``) that are only called when rendering.
page load, but its template isn't rendered. So keep your heavy work to
methods in your component (e.g. ``getProducts()``) that are only called
from the component's template.

Loading "defer" (Ajax on Load)
~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 0ac7329

Please sign in to comment.