An open API service indexing awesome lists of open source software.

https://github.com/maxmellon/react-tiny-linkify

A library convert to anchor tag from text children as react component. (< 1KB)
https://github.com/maxmellon/react-tiny-linkify

Last synced: 4 months ago
JSON representation

A library convert to anchor tag from text children as react component. (< 1KB)

Awesome Lists containing this project

README

          

# react-tiny-linkify

> A library convert to anchor tag from text children as react component.

- very tiny
- simple usage
- so simple

- - -

## Instillation

```
$ npm i react-tiny-linkify
```

## Usage

```jsx
import React from 'react'
import linkify from 'react-tiny-linkify'

const Example: React.FC<{ children: string }> = ({ children }) => (

{linkify(children)}


)

const element = (

example: https://example.com

)

/*
* got: ReactElement
*


* example: https://example.com
*


*/
```

- with memo

```jsx
const Example: React.FC<{ content: string }> = ({ content }) => {
const linked = useMemo(() => linkify(content), [content])
return (

{linked}


)
}
```