Skip to content

Commit

Permalink
refactor: rename hook folder in site
Browse files Browse the repository at this point in the history
  • Loading branch information
juliencrn committed Sep 19, 2022
1 parent c24c270 commit d4b0526
Show file tree
Hide file tree
Showing 103 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion site/src/hooks-doc/index.ts → site/src/content/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from '../hooks-hidden/useSiteMetadata'
export * from './useBoolean'
export * from './useClickAnyWhere'
export * from './useCopyToClipboard'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function Component() {
const { value, setValue, setTrue, setFalse, toggle } = useBoolean(false)

// Just an example to use "setValue"
const customToggle = () => setValue(x => !x)
const customToggle = () => setValue((x: boolean) => !x)

return (
<>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ date: '2022-01-01'

A simple countdown implementation. Support increment and decrement.

<!-- TODO: usehooks-ts@3 , remove "THE NEW" in next line -->

NEW VERSION: A simple countdown implementation. Accepts `countStop`(new), `countStart` (was `seconds`), `intervalMs`(was `interval`) and `isIncrement` as keys of the call argument. Support increment and decrement. Will stop when at `countStop`.

Related hooks:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useCounter } from 'usehooks-ts'
export default function Component() {
const { count, setCount, increment, decrement, reset } = useCounter(0)

const multiplyBy2 = () => setCount(x => x * 2)
const multiplyBy2 = () => setCount((x: number) => x * 2)

return (
<>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Component() {
const [isDarkTheme, setDarkTheme] = useLocalStorage('darkTheme', true)

const toggleTheme = () => {
setDarkTheme(prevValue => !prevValue)
setDarkTheme((prevValue: boolean) => !prevValue)
}

return (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default function Component() {
return (
<div>
<p>Count: {value}</p>
<button onClick={() => setValue(x => x + 1)}>Increment</button>
<button onClick={() => setValue(x => x - 1)}>Decrement</button>
<button onClick={() => setValue((x: number) => x + 1)}>Increment</button>
<button onClick={() => setValue((x: number) => x - 1)}>Decrement</button>
</div>
)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d4b0526

Please sign in to comment.