Reactjs String Replace Example




Reactjs String Replace Example

Hello friends,

In this blog, i will show you how to replace string in reactjs. We will talk about string replace example in reactjs. i would like to share with you how to string replace in reactjs.

In this example i have simple string replace and i will perform to get replace string It is possible by replace method. Its help to replace string in reactjs.

Here i will give you simple example to replace string "Hi Dev!" into "Hi Guys!" . It is very easy and simple, So you can understand easily.


import React from 'react'

export default class Home extends React.Component{


var myStr = "Hi Dev!";

var newStr = myStr.replace("Dev", "Guys");



<h1>String Replace Example</h1>

<p><strong>Old String : </strong>{myStr}</p>

<p><strong>New String : </strong>{newStr}</p>





It will help you...