react-anchorme
🚀 Installation
npm i react-anchorme
yarn add react-anchorme
🖲 Usage
Basic usage
Component takes string as a children, detects urls, emails, IP addresses in it and replaces them with clickable links.
import React from 'react'
import { Anchorme } from 'react-anchorme'
const SomeComponent = () => {
return (
<Anchorme>Lorem ipsum http://example.loc dolor sit amet</Anchorme>
)
}
Custom props
You can set custom anchor props that are applied to every link created by the component.
import React from 'react'
import { Anchorme } from 'react-anchorme'
const SomeComponent = () => {
return (
<Anchorme target="_blank" rel="noreferrer noopener">
Lorem ipsum http://example.loc dolor sit amet
</Anchorme>
)
}