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

Does not work with dangerouslySetInnerHTML #67

Open
leedongwei opened this issue Jul 30, 2018 · 4 comments
Open

Does not work with dangerouslySetInnerHTML #67

leedongwei opened this issue Jul 30, 2018 · 4 comments

Comments

@leedongwei
Copy link

leedongwei commented Jul 30, 2018

Hello! I ran into this bug while using the library. Linkify does not work when wrapping a component that's created with dangerouslySetInnerHTML. The use-case for that is to generate templates (e.g. blog posts) that was saved in a database.

// This identifies the URI and wraps it with an anchor text
<Linkify>
  <p>
    <span>Go to https://google.com</span>
  </p>
</Linkify>

// This did not catch the link
<Linkify>
  <p dangerouslySetInnerHTML={{ __html: '<span>Go to https://google.com</span>'}} />
</Linkify>
@miklschmidt
Copy link

miklschmidt commented Sep 3, 2018

It's a pretty easy fix, the parse function just has to check dangerouslySetInnerHTML.__html as well as children, but this repo seems fairly dead.

@bezunakarmi
Copy link

Any updates on this issue?

@kollynlund
Copy link

Any update on this issue?

@codigoderey
Copy link

The is the work around and it worked just fine for me.

dangerouslySetInnerHTML={{ __html: ReactDOMServer.renderToString(<Linkify><span>Go to https://google.com</span></Linkify>) }}

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

No branches or pull requests

5 participants