Why?
function performSearch() {
axios
.get('/search/v1', {
params: {
token,
query_str,
},
})
.then(({ data }) => {
const { messages } = data;
if (typeof messages !== "undefined" && !Array.isArray(messages)) return;
setMessages(messages);
setLoading(false);
})
.catch((err) => {
setLoading(false);
});
}