Skip to content

Commit

Permalink
Add React Native and SSR support notes to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
desko27 committed Aug 16, 2024
1 parent 0d334e0 commit e02e5a0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Bring your React component, `react-call` gives you the `call(<props>)` method.
- ⛓️‍πŸ’₯ Not limited by a context provider
- 🀯 Call from outside React
- πŸŒ€ Flexible: it's your component
- πŸš€ Supports React Native and SSR
- πŸ“¦ Extremely lightweight: <500B
- πŸ•³οΈ Zero dependencies

Expand Down Expand Up @@ -62,7 +63,7 @@ Present a piece of UI to the user, wait for it to be used and get the response d
- βœ… Confirmations, dialogs
- βœ… Notifications, toasts
- βœ… Popup forms, modals
- βœ… Or anything! πŸš€ [Build your thing](#-build-your-thing)
- βœ… Or anything! πŸ¦„ [Build your thing](#-build-your-thing)

# Usage

Expand Down Expand Up @@ -113,7 +114,7 @@ Place `Root` once, which is what listens to every single call and renders it. An
> [!WARNING]
> Since it's the source of truth, there can only be one `Root`. Avoid placing it in multiple locations of the React Tree at the same time, an error will be thrown if so.
# πŸš€ Build your thing
# πŸ¦„ Build your thing

Again, this is no way limited to confirmation dialogs. You can build anything!

Expand Down Expand Up @@ -149,5 +150,14 @@ ReactCall.Callable<Props, Response> | What createCallable returns

Error | Solution
--- | ---
No \<Root> found! | You forgot to place the Root, check [Place the Root](#2--place-the-root) section. If it's already in place but not present by the time you call(), you may want to place it higher in your React tree.
No \<Root> found! | You forgot to place the Root, check [Place the Root](#2--place-the-root) section. If it's already in place but not present by the time you call(), you may want to place it higher in your React tree. If you're getting this error on the server see [SSR section](#does-the-setup-work-with-ssr).
Multiple instances of \<Root> found! | You placed more than one Root, check [Place the Root](#2--place-the-root) section as there is a warning about this.

# SSR

The react-call setup supports [Server Side Rendering](https://nextjs.org/docs/pages/building-your-application/rendering/server-side-rendering), so there's nothing wrong with it on the server.

However, bear in mind that the call() method is designed as a client-only feature. As long as you don't run the call() method on the server you'll be fine.

> [!CAUTION]
> If call() is run on the server, a "No \<Root> found!" error will be thrown.

0 comments on commit e02e5a0

Please sign in to comment.