Skip to content

Commit

Permalink
Typo fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fromthemills committed Apr 3, 2024
1 parent de61957 commit 44d644e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions website/docs/tutorials/react-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export function Welcome() {

## Server components

Lingui can be easily be used with server components. There are however some considerations to be made so we can make optimal use of server components and it's capabilities.
Lingui can easily be used with server components. There are however some considerations to be made so we can make optimal use of server components and it's capabilities.

1. We want to avoid shipping to much js to the browser if it is not needed
2. We want to be able to use both the `Trans` and `TransNoContext` inside our components. The difference been that `Trans` will be shipped as part of the js bundle and `TransNoContext` not.
Expand Down Expand Up @@ -344,7 +344,7 @@ export default function I18nProvider({ locale, messages, ...props }) {
If we take a closer look at `loadMessages` and `setI18n` function in the layout file. The `loadMessages` function will just return the correct catalog based on the locale. The function `setI18n` is more exotic. This uses a new react feature called [`cache`](https://react.dev/reference/react/cache). The React cache function allows you to memoize the return value of a function, allowing you to call the same function multiple times while only executing it once. This is useful in that we can set an instance of `i18n` for later usage in our nested components.

:::note
The file `locales.js` below imports all catalogs so it is important that you don't import this file into a client component otherwise als catalogs will be part of the js bundle.
The file `locales.js` below imports all catalogs so it is important that you don't import this file into a client component otherwise all catalogs will be part of the js bundle.
:::

```jsx
Expand Down

0 comments on commit 44d644e

Please sign in to comment.