Skip to content

Commit 1332278

Browse files
committed
Fix some of the deepsource
1 parent 871763e commit 1332278

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

examples/vite/src/app/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import React from "react";
1+
import React, { useCallback } from "react";
22
import "./styles.css";
33
import { Bars1, Bars2, Dots1, Dots2 } from "react18-loaders/dist/server";
44
import { LoaderContainer, useLoader } from "react18-loaders";
55

66
/** Vite App */
77
function App(): JSX.Element {
88
const { setLoading } = useLoader();
9+
const handleClick = useCallback(() => setLoading(true), []);
910
return (
1011
<div className="container">
1112
<h1 className="title">
@@ -16,7 +17,7 @@ function App(): JSX.Element {
1617
<Dots2 color="#00f" width={50} dotRadius={8} />
1718
<Bars2 color="red" width={50} />
1819
<Bars1 color="red" width={50} />
19-
<button onClick={() => setLoading(true)}>Show loader</button>
20+
<button onClick={handleClick}>Show loader</button>
2021
<LoaderContainer>
2122
<Bars1 color="red" width={50} />
2223
</LoaderContainer>

packages/shared/src/client/drawer-button/drawer-button.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { DrawerButton } from "./drawer-button";
55
describe.concurrent("drawer-button", () => {
66
afterEach(cleanup);
77

8+
const dummyFunc = () => {};
89
test("check if h1 heading exists", () => {
9-
render(<DrawerButton open setOpen={() => {}} />);
10+
render(<DrawerButton open setOpen={dummyFunc} />);
1011
});
1112
});

packages/shared/src/client/drawer-button/drawer-button.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use client";
2-
import { Dispatch, SetStateAction } from "react";
2+
import { Dispatch, SetStateAction, useCallback } from "react";
33
import styles from "./drawer-button.module.scss";
44

55
interface DrawerButtonProps {
@@ -12,10 +12,11 @@ interface DrawerButtonProps {
1212
* Drawer button to toggle side navigation on mobile devices.
1313
*/
1414
export function DrawerButton({ open, setOpen }: DrawerButtonProps) {
15+
const handleClick = useCallback(() => setOpen(open => !open), []);
1516
return (
1617
<button
1718
className={[styles.drawerBtn, "mb", open ? styles.open : ""].join(" ")}
18-
onClick={() => setOpen(!open)}>
19+
onClick={handleClick}>
1920
<div />
2021
<div />
2122
<div />

packages/shared/src/client/dummy/dummy.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { HTMLProps } from "react";
1+
import { HTMLProps, ReactNode } from "react";
22

3-
interface DummyProps extends HTMLProps<HTMLDivElement> {}
3+
interface DummyProps extends HTMLProps<HTMLDivElement> {
4+
children: ReactNode;
5+
}
46

57
/**
68
*

0 commit comments

Comments
 (0)