Open efstathiosntonas opened 4 years ago
I did it like this:
const onKeywordChange = (keyword: string) => {
setSuggestedMentions([]);
requestAPI({
params: `/mentions/nickname/${encodeURIComponent(keyword)}`,
method: "GET"
}).then(({ success, suggestions }) => {
if (success) {
setSuggestedMentions(suggestions);
} else { throw "error"; }
}).catch((error) => {
console.log("getUsersByUserName error:", error);
});
};
Hope it helps you.
Hi, can you please provide an example with an api call to fetch data? Thanks