1.0.1 • Published 11 months ago
@hyune/react v1.0.1
A React utilities library.
"react": ">=17.0.0 <19.0.0",
"react-dom": ">=17.0.0 <19.0.0"
Installation
To install the package, run:
npm install @hyune/react
Hooks
useDebounce
const [input, setInput] = useState("")
const handleChange = (e) => setInput(e.target.value)
const debounce = useDebounce(input, 300)
useObserver
const handleAlert=()=>alert("Find Element");
const divEl =useObserver(handleAlert)
<div ref={divEl}/>
useWindowSize
const { width, height } = useWindowSize()
useModal
import React from "react"
import { useModal } from "@hyune/react/hooks"
const ExampleComponent = () => {
const { openModal, closeModal, Modal } = useModal()
return (
<div>
<button onClick={openModal}>Open Modal</button>
<Modal
dismissOnOutsideClick={true}
modalClassName="example-modal"
overlay={true}
overlayClassName="example-overlay"
>
<div>
<h2>Modal Title</h2>
<p>This is the content of the modal.</p>
<button onClick={closeModal}>Close Modal</button>
</div>
</Modal>
</div>
)
}
export default ExampleComponent
Utils
fetcher
try {
const data = await fetcher("/api/data")
console.log("Data:", data)
} catch (error) {
console.error("Error fetching data:", error)
}
1.0.1
11 months ago
1.0.0
11 months ago
0.0.48
11 months ago
0.0.47
11 months ago
0.0.46
11 months ago
0.0.45
11 months ago
0.0.44
11 months ago
0.0.43
11 months ago
0.0.42
11 months ago
0.0.41
11 months ago
0.0.40
11 months ago
0.0.39
11 months ago
0.0.38
11 months ago
0.0.37
11 months ago
0.0.36
12 months ago
0.0.35
12 months ago
0.0.32
12 months ago
0.0.31
12 months ago
0.0.30
12 months ago
0.0.29
12 months ago
0.0.28
12 months ago
0.0.27
12 months ago
0.0.26
12 months ago
0.0.25
12 months ago
0.0.24
12 months ago
0.0.23
12 months ago
0.0.21
12 months ago
0.0.20
12 months ago
0.0.19
12 months ago
0.0.18
12 months ago
0.0.17
12 months ago
0.0.16
12 months ago
0.0.15
12 months ago
0.0.14
12 months ago
0.0.13
12 months ago
0.0.12
12 months ago
0.0.11
12 months ago
0.0.10
12 months ago
0.0.9
12 months ago
0.0.8
12 months ago
0.0.7
12 months ago
0.0.6
12 months ago
0.0.5
12 months ago
0.0.4
12 months ago
0.0.3
12 months ago
0.0.2
12 months ago
0.0.1
12 months ago