Skip to content
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

feat(@yourssu/react): create useSecTimer, useMediaQuery #22

Merged
merged 3 commits into from
Jun 7, 2024

Conversation

Hanna922
Copy link
Member

@Hanna922 Hanna922 commented Jun 4, 2024

1️⃣ 어떤 작업을 했나요? (Summary)

기존 코드에 영향을 미치지 않는 변경사항

useSecTimer, useMediaQuery를 생성합니다. 두 hook 모두 기존 Soomsil 코드에서 변경된 부분이 있습니다.

useSecTimer

ReturnType<typeof setInterval>: Node.js 환경에서 NodeJS.Timeout, Browser 환경에서 number로 type 인식

const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);

useMediaQuery

Node.js 환경일 경우(window is not defiend) return 합니다.

  useEffect(() => {
    // If window is not defined, it means that the code is running on the server side.
    if (typeof window === 'undefined') {
      return;
    }
  ...

기존 코드에 영향을 미치는 변경사항

  • useInterval md 파일의 형식을 통일시킴과 동시에 ko.md로 변경하였으며 en.md를 생성하였습니다.

3️⃣ 추후 작업

  • useDebounce, useThrottle

4️⃣ 체크리스트 (Checklist)

  • main 브랜치의 최신 코드를 pull 받았나요?

@Hanna922 Hanna922 added feat New feature or request react @yourssu/react labels Jun 4, 2024
@Hanna922 Hanna922 self-assigned this Jun 4, 2024
Copy link
Member

@intersoom intersoom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

죠아요 !

Copy link
Collaborator

@owl1753 owl1753 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깔끔하네용~

@Hanna922 Hanna922 merged commit 7f0fd57 into main Jun 7, 2024
1 check passed
@Hanna922 Hanna922 deleted the feat/#16-react-hooks branch June 7, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request react @yourssu/react
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: create useMediaQuery, useSecTimer in react
3 participants