In order to make that dynamic you should be doing something like this:
const apiUrl = () => `...${searchText}...`
You create a function to be executed and return the current value when you need it.
And then when you need to call it:
// just an example...
const url = apiUrl()
fetch(url)...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…