如何将html转换为jsx,同时转换<a> tags to <link/> tags

时间:2016-02-26 10:04:47

标签: reactjs react-router

I have a bunch of html content in a database which includes many embedded local links.

I need to render this content using react. However I also want to convert any local links to react-router <Link> tags.

I could use dangerouslySetInnerHTML. However I am unsure how best to convert the links.

I've also found a few packages such as htmltojsx。但是我不确定使用这些软件包转换链接的最佳方法。

这一定是一个相当普遍的问题,通常如何解决?

0 个答案:

没有答案