Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support formatting of React elements via format.list(…). #845

Merged
merged 7 commits into from
Feb 8, 2024

Conversation

amannn
Copy link
Owner

@amannn amannn commented Feb 8, 2024

import {useFormatter} from 'next-intl';

function Component() {
  const format = useFormatter();

  const users = [
    {id: 1, name: 'Alice'},
    {id: 2, name: 'Bob'},
    {id: 3, name: 'Charlie'}
  ];

  // Returns a `ReactNode`
  return format.list(
    users.map((user) => (
      <a key={user.id} href={`/user/${user.id}`}>
        {user.name}
      </a>
    ))
  );
}

As discussed in #840

Copy link

vercel bot commented Feb 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 8, 2024 3:54pm
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 8, 2024 3:54pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant