Update README.md

This commit is contained in:
Luke Hagar
2022-08-04 15:05:15 -05:00
committed by GitHub
parent 8a09a27be7
commit 3159dfb1ac

View File

@@ -115,6 +115,25 @@ const [plexTVAuthToken, setPlexTVAuthToken] = useState(
);
```
### Intersection observer Callback usage
``` JavaScript
if (libraryItems?.length === index + 100) {
return (
<Grid item xs="12" key={Obj.guid + index}>
<ListItem ref={lastLibraryItem}>
<ListItemAvatar>
<Avatar alt={NoArt} src={Obj.thumb} />
</ListItemAvatar>
<Typography variant="h6" noWrap>
{Obj.title} - {Obj.grandparentTitle} -{' '}
{Obj.parentTitle}
</Typography>
</ListItem>
</Grid>
);
}
```
### Intersection observer to load more library items when the callbackref object comes into view
``` JavaScript
const observer = useRef();