-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript UI #434
Typescript UI #434
Conversation
|
||
React.useEffect(() => { | ||
load(); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to get rid of this es-lint-disable you can extract the inline callback from usePromise
to a function declared outside of the component, and then use this function inside usePromise
and then use the load
function in the dependencies array e.g.
const getVersion = () => versionService.getVersion(); const Footer: React.FC = () => { const [result, load] = usePromise<VersionData, any, any>(getVersion); React.useEffect(() => { load(); }, [load]); (...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versionService.getVersion()
is already a function declared outside component in separate module. load
changes reference anyway and causes rerender.
!result.isIdle && clear(); | ||
}); | ||
|
||
return result.match({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
No description provided.