Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Commit

Permalink
Document LiveUpdate.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed Mar 8, 2019
1 parent 0d94139 commit fbf3349
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -104,6 +104,16 @@ For example:

Learn how to [create your own LDflex expressions](https://github.com/solid/query-ldflex/#creating-data-paths).

#### Automatically refresh when data is updated
Different Solid apps can write to the same documents at the same time.
If you put components inside of `<LiveUpdate>`,
they will refresh when data is updated externally.
In the `subscribe` attribute, list the documents that should be tracked for updates;
set it to `*` (default) if you want to listen to all documents accessed by your app.
Use live updates sparingly,
since change monitoring consumes additional resources,
especially when monitoring documents on different data pods.


## 💪🏾 Create your own components
The Solid React library makes it easy
Expand Down Expand Up @@ -188,6 +198,11 @@ function BlogPosts({ author = 'https://ruben.verborgh.org/profile/#me' }) {
}
```

If your components should automatically refresh on updates
when placed inside of a `<LiveUpdate>` component,
use the `useLiveUpdate` hook (already included in all 3 `useLDflex` hooks).
It returns the latest update as `{ timestamp, url }`.

## License
©2018–present [Ruben Verborgh](https://ruben.verborgh.org/),
[MIT License](https://github.com/solid/react-components/blob/master/LICENSE.md).

0 comments on commit fbf3349

Please sign in to comment.