Skip to content

Commit

Permalink
docs: Note on merging shared tags (fixes #1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Nov 5, 2024
1 parent fdcfa24 commit c4d6859
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/src/pages/docs/usage/messages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,17 @@ export default function RichText({children}: Props) {
}
```

If you need to combine shared tags with values from your component, you can merge them accordingly by using the spread operator:

```js
function UserPage({username}) {
const t = useTranslations('UserPage');
return (
<RichText>{(tags) => t.rich('description', {...tags, username})}</RichText>
);
}
```

</Details>

<Details id="rich-text-self-closing">
Expand Down

0 comments on commit c4d6859

Please sign in to comment.