Skip to content

Commit 4898dd5

Browse files
committed
Remove extra function
1 parent c73deb1 commit 4898dd5

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/components/Stars/index.tsx

+7-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@ import { useText } from 'jsx-dom-runtime';
22

33
import s from './styles.css';
44

5-
const getStars = (): Text => {
6-
const [stars, setStars] = useText('-');
5+
const [stars, setStars] = useText('-');
76

8-
if (process.env.NODE_ENV === 'production') {
9-
fetch('https://api.github.com/repos/shoonia/1x1')
10-
.then((response) => response.json())
11-
.then((data) => setStars(data.stargazers_count || '-'));
12-
}
13-
14-
return stars;
15-
};
7+
if (process.env.NODE_ENV === 'production') {
8+
fetch('https://api.github.com/repos/shoonia/1x1')
9+
.then((response) => response.json())
10+
.then((data) => setStars(data.stargazers_count || '-'));
11+
}
1612

1713
export const Stars: JSX.FC = () => (
1814
<div class={s.box}>
@@ -32,7 +28,7 @@ export const Stars: JSX.FC = () => (
3228
tabIndex={0}
3329
class={s.stars}
3430
>
35-
{getStars()}
31+
{stars}
3632
</a>
3733
</div>
3834
);

0 commit comments

Comments
 (0)