linkify-react is a React component that provides an interface to the underlying linkifyjs library, enabling the automatic detection and conversion of URLs, email addresses, and other specified patterns (such as hashtags via plugins) within text content into clickable HTML `<a>` elements. The current stable version is `4.3.2`. This package is actively maintained, with frequent patch and minor releases, often in close alignment with updates to the core `linkifyjs` library. A key differentiator is its seamless integration into React applications, allowing developers to declaratively render linkified text. It offers extensive customization options for link behavior, attributes, and rendered element types, abstracting away direct DOM manipulation. It serves as a user-friendly wrapper over `linkifyjs` to handle the complexities of parsing and rendering links within a React component tree.
npm install linkify-reactVerified import paths — ran on the pinned version, not inferred.
Demonstrates the basic usage of the Linkify component and advanced customization options. It shows how to apply custom attributes, format link text, provide custom React components for links, handle specific link types like hashtags, and validate links before rendering.
Ensure target browsers are newer than Safari 10, or consider pinning to an older linkify-react version if Safari 10 support is critical.
Run `npm install linkifyjs linkify-react` or `yarn add linkifyjs linkify-react`.
Add `import 'linkifyjs/plugins/hashtag';` or similar imports at the top level of your application or component where `Linkify` is used.
Verify that your bundler or module resolver correctly handles `.cjs` and `.mjs` extensions. For most users relying on `package.json`'s `main` and `module` fields, no action is needed.
Install `linkifyjs` as a direct dependency: `npm install linkifyjs` or `yarn add linkifyjs`.
Use `import Linkify from 'linkify-react';` for ESM or `const Linkify = require('linkify-react');` for CommonJS (as it's a default export that works well with CJS interop).Add `import 'linkifyjs/plugins/hashtag';` to your application's entry file or the component file where `Linkify` is used.