SSIA
starください↓
作った経緯
似たようなライブラリがあったが、lodash使ってたのでtsで頑張ってみたくなった。
ついでにnpm初publishした
作った感想
型を合わせるのがしんどい
ts書いてると常に思う
使い方
こんな感じに使えます
import stringReplaceJsx from "string-replace-jsx";
<div>
{stringReplaceJsx("fuga https://google.com", urlRegex, (match) => (
<a
className={styles.link}
href={match.toString()}
target="_blank"
rel="noreferrer"
>
{match}
</a>
))}
</div>;