react-string-replace
react-string-replace copied to clipboard
I have a problem with '/r' in text. It not working '/r'
result : reactStringReplace output not working '/r' in array[2] image above
My guess (because I had the same bug) is that you need to use a capturing group in your regex:
let el = reactStringReplace(el, /(\n)/g, (_match, i) => <br key={i} />);
Note the use of /(\n)/g
rather than just /\n/g
.