Skip to content

Commit

Permalink
feat: react
Browse files Browse the repository at this point in the history
  • Loading branch information
wkylin committed Dec 10, 2024
1 parent d45a776 commit da07d8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/hooks/useCycle/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import React, { useState } from 'react'

Check warning on line 1 in src/components/hooks/useCycle/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused import

Unused imported default binding React

Check failure on line 1 in src/components/hooks/useCycle/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

ESLint

ESLint: Install the 'eslint' package

const useCycle = (options = [], defaultValue = '') => {
const [index, setIndex] = React.useState(defaultValue ? undefined : 0)
const [index, setIndex] = useState(defaultValue ? undefined : 0)
const next = () => setIndex((i) => ((i ?? -1) + 1) % options.length)

return [index == null && defaultValue ? defaultValue : options[index ?? 0], next]
Expand Down
4 changes: 2 additions & 2 deletions src/components/hooks/useRootClick/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import React, { useEffect } from 'react'

Check warning on line 1 in src/components/hooks/useRootClick/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused import

Unused imported default binding React

Check failure on line 1 in src/components/hooks/useRootClick/index.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

ESLint

ESLint: Install the 'eslint' package

const useRootClick = (cb = () => {}) => {
React.useEffect(() => {
useEffect(() => {
const controller = new AbortController()
document.documentElement.addEventListener(
'click',
Expand Down

0 comments on commit da07d8f

Please sign in to comment.