Skip to content

Commit

Permalink
Fix eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
khshourov committed Nov 4, 2024
1 parent 441dfd6 commit c2d2164
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions views/interactivity/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useMemo } from 'react';
import './App.css';
import { DictionaryApi } from './components/api/dictionary';
import { ErrorResultView } from './components/general/ErrorResultView';
Expand Down Expand Up @@ -32,7 +32,10 @@ function App() {
throw new NoBearerTokenError();
}
const searchWord = queryParams.get('searchWord');
const dictionaryApi = new DictionaryApi({ token: bearerToken });
const dictionaryApi = useMemo(
() => new DictionaryApi({ token: bearerToken }),
[bearerToken],
);

useEffect(() => {
if (searchWord && searchWord.trim().length > 0) {
Expand All @@ -45,7 +48,7 @@ function App() {
handleError(err);
});
}
});
}, [dictionaryApi, searchWord]);

return (
<>
Expand Down

0 comments on commit c2d2164

Please sign in to comment.