react 对字符串是否包含特定字符的判断,使用includes来判断:

const myString = "Hello [World]";
if (myString.includes("[")) {
console.log("字符串包含'['");
} else {
console.log("字符串不包含'['");
}