Dev Helpers
← Back

Unique vocabulary list

Import and render <UniqueVocabularyList /> in a React project.

Open this example in the interactive library

Live preview

Source code

// components/UniqueVocabularyList.tsx

export default function UniqueVocabularyList({
  source = "Copper Studio North",
}: { source?: string } = {}) {
  const words = source.toLowerCase().match(/\p{L}+/gu) ?? [];
  return (
    <ul>
      {[...new Set(words)].sort().map((w) => (
        <li key={w}>{w}</li>
      ))}
    </ul>
  );
}