0.0.3 • Published 3 years ago

replace-react v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Replace React

ReplaceReact is a library that provides you a way to replace substrings into react components

You have two ways to do it

One: import replaceReact from replace-react

import { replaceReact } from "replace-react";

const MyApp = () => {
  return (
    <div>
      {replaceReact("hello world", /(world)/g, (match, key) => (
        <h1 key={key}>{match}</h1>
      ))}
    </div>
  );
};

Two: import the extendString file and use it directly with your strings

import "replace-react/extendString";

const MyApp = () => {
  return (
    <div>
      {"hello world".replaceReact(/(world)/g, (match, key) => (
        <h1 key={key}>{match}</h1>
      ))}
    </div>
  );
};

by Quaantum