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
Copy file name to clipboardExpand all lines: README.md
+28-1Lines changed: 28 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,8 +28,10 @@ This is a set of components that is to be used to build a Quintype Node App. Thi
28
28
* [Search box](#search-box)
29
29
* [SocialShare](#socialshare)
30
30
* [StoryElement](#storyelement)
31
+
* [WithClientSideOnly](#withclientsideonly)
31
32
* [WithError](#witherror)
32
33
* [WithHostUrl](#withhosturl)
34
+
* [WithLazy](#withlazy)
33
35
* [WithMember](#withmember)
34
36
* [WithPreview](#withpreview)
35
37
* [WithSocialLogin](#withsociallogin)
@@ -102,7 +104,7 @@ function interstitial(index) {
102
104
```
103
105
104
106
### ClientSideOnly
105
-
This component will be loaded by client, and bypassed when doing server side rendering.
107
+
This component will be loaded by client, and bypassed when doing server side rendering. Also see [WithClientSideOnly](#WithClientSideOnly) for a render props version.
{clientSideRendered &&<span>This will be shown only on the client side</span>}
534
+
)}
535
+
</WithClientSideOnly>
536
+
```
537
+
523
538
### WithError
524
539
This function can be used to generate a wrapper component that implements `componentDidCatch()`.
525
540
@@ -548,6 +563,18 @@ import { WithHostUrl } from '@quintype/components';
548
563
}</WithHostUrl>
549
564
```
550
565
566
+
### WithLazy
567
+
568
+
This component can be used to load some DOM just before it scrolls into the screen. Currently, it does not support unloading. The `margin` prop is passed to `IntersectionObserver`.
569
+
570
+
```javascript
571
+
import { WithLazy } from'@quintype/components';
572
+
573
+
<WithLazy margin="50px">{() =>
574
+
<SomeHeavyComponent />
575
+
}</WithLazy>
576
+
```
577
+
551
578
### WithMember
552
579
This is a render props component which will call your callback with the current logged in member. It will automatically call `/api/v1/members/me` to figure out if you are logged in, and replace the contents in the store and callback. In future, this may use LocalStorage to cache the member for some time.
0 commit comments