In the React project, I first get a string. I want to highlight the keywords in this string. How to solve this problem?

799 windy version of the infinite horizon of the empty mountain

I"m done here now. I don"t know how to go on. I"d like to ask you to help me write a simple demo

.
let values = item.split("");

let valuesContent = values.join(`keyWord`);


I don"t know how to write {} in

{} < / div > ? There is no train of thought

Mar.31,2021

The general idea of

is to use regular replacement keywords with highlighted tags

const string = '799';
const keyWord = '';
const reg = new RegExp(keyWord, 'g');
const result = string.replace(reg, `<b>${keyWord}</b>`);
console.log(result)
Menu