1.0.1 • Published 12 months ago

@hyune/react v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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

12 months ago

1.0.0

12 months ago

0.0.48

1 year ago

0.0.47

1 year ago

0.0.46

1 year ago

0.0.45

1 year ago

0.0.44

1 year ago

0.0.43

1 year ago

0.0.42

1 year ago

0.0.41

1 year ago

0.0.40

1 year ago

0.0.39

1 year ago

0.0.38

1 year ago

0.0.37

1 year ago

0.0.36

1 year ago

0.0.35

1 year ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.30

1 year ago

0.0.29

1 year ago

0.0.28

1 year ago

0.0.27

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago