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

Output React component #38

Open
fregante opened this issue Jan 10, 2023 · 1 comment
Open

Output React component #38

fregante opened this issue Jan 10, 2023 · 1 comment

Comments

@fregante
Copy link
Collaborator

fregante commented Jan 10, 2023

import {LinkifyUrls} from "linkify-urls/react"

<LinkifyUrls
	string='a string with https://example.com'
	target="_blank"
/>

Does it make sense as part of this module? The current solution:

<div
  dangerouslySetInnerHTML={{
    __html: linkifyUrls('a string with https://example.com', {
      attributes: {
        target: "_blank",
      },
    }),
  }}
></div>

React does not accept DocumentFragment and other raw elements.

@sindresorhus
Copy link
Owner

Sure

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

No branches or pull requests

2 participants