Skip to content

Commit

Permalink
Compilation error
Browse files Browse the repository at this point in the history
Compilation revealed 'use<function-name>' for seemingly any valid string <function-name> will be treated as a react hook even if it is not. This meant compiling 'useSearch' was not allowed since it was used in a callback function even though it is not a react hook!! This is fixed simply by renaming the function...
  • Loading branch information
wilzet committed Sep 9, 2024
1 parent b78ec04 commit 4098376
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/search-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function SearchButton(props: SearchButtonProps) {
}
}

const useSearch = (post: PostUI) => {
const searchedPostUse = (post: PostUI) => {
closeSearch();
props.callback(post);
}
Expand All @@ -66,7 +66,7 @@ export default function SearchButton(props: SearchButtonProps) {
<Button
value={'Use'}
active={true}
onClick={() => useSearch(post)}
onClick={() => searchedPostUse(post)}
style={{ margin: '5px', marginBottom: '25px', marginRight: '20px', float: 'right' }}
/>
);
Expand Down

0 comments on commit 4098376

Please sign in to comment.