Hot to call this function from another component in react?
function uCyr() {
var entered_text;
entered_text = document.getElementById('textarea').value;
entered_text = entered_text.replace(/a/g, 'b');
document.getElementById('textarea').style.color = '#9C27B0';
document.getElementById('textarea').value = entered_text;
}
It's a good thing to bind first this function in your constructor, so you won't have a scope problem.
Then you can create a ref in the "another component" and apply it to this component where you have this function. Then you can call this.yourRef.current.uCyr()