Lädt...


🔧 scriptkavi/hooks: Customizable and Open Source React Hooks


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

What is scriptkavi/hooks?

In the fast-paced world of web development, staying ahead means constantly evolving and adopting new tools and practices. React, one of the most popular JavaScript libraries, introduced hooks to simplify state management and side effects in functional components. However, as powerful as hooks are, we saw an opportunity to take them even further.

scriptkavi/hooks is a collection of re-usable hooks that you can copy and paste into your apps.

How to install scriptkavi/hooks in your NextJS application?

Start by creating a new Next.js project using create-next-app:

npx create-next-app@latest scriptkavi-app --typescript --eslint

Now enter scriptkavi-app by running

cd scriptkavi-app

Install package dependencies by running

npm install

Run the scriptkavi-hooks init command to setup your project:

npx scriptkavi-hooks@latest init

You will be asked a few questions to configure hooks.json:

Would you like to use TypeScript (recommended)? no/yes
Which codestyle would you like to use? › React Hooks
Configure the import alias for hooks: › @/hooks
Configure the import alias for utils: › @/lib/utils

That's it

You can now start adding hooks to your project.

npx scriptkavi-hooks@latest add debounce

The command above will add the Debounce hook to your project. You can then import it like this:

import { useDebounce } from "@/hooks/debounce"

export default function App() {
  const [searchTerm, setSearchTerm] = React.useState("js")
  const debouncedSearchTerm = useDebounce(searchTerm, 300)

  const handleChange = (e) => {
    setSearchTerm(e.target.value)
  }

  React.useEffect(() => {
    const callApi = async () => {
      if (debouncedSearchTerm) {
        // Call Api
      }
    }
    callApi()
  }, [debouncedSearchTerm])

  return (
    <form>
      <input
        name="search"
        placeholder="Search something..."
        onChange={handleChange}
      />
    </form>
  )
}

There is a massive list of hooks you can add that scriptkavi/hooks provides, you can find the list here.

Similarly you can add other hooks like,

npx scriptkavi-hooks@latest add battery
npx scriptkavi-hooks@latest add click-away

and many more...

Frameworks support

scriptkavi/hooks supports NextJS and Vite

Join the Revolution

Our library is open source so you can start contributing to the project by adding more hooks. You can find the github project here.

Our mission is to empower developers to build amazing applications with ease and efficiency. By providing a robust set of hooks, we aim to transform the way you develop with React. Explore our documentation, contribute to the project, and be part of the revolution in React development.

...

🔧 scriptkavi/hooks: Customizable and Open Source React Hooks


📈 96.52 Punkte
🔧 Programmierung

🔧 How I Achieved 40 Stars in 2 Weeks After Launching ScriptKavi/Hooks


📈 48.26 Punkte
🔧 Programmierung

🔧 React Hooks – How to Use the useState & useEffect Hooks in Your Project


📈 31.97 Punkte
🔧 Programmierung

🔧 React Hooks – How to Use the useState & useEffect Hooks in Your Project


📈 31.97 Punkte
🔧 Programmierung

🔧 Bloodline of Hooks: Custom Hooks in React for Advanced Devs


📈 31.97 Punkte
🔧 Programmierung

🔧 Open Source is More Secure than Closed Source because Closed Source is More Secure than Open Source


📈 30.68 Punkte
🔧 Programmierung

🔧 How we create an open-source alternative to v0.dev. But highly customizable and live in your Github.


📈 28.74 Punkte
🔧 Programmierung

🔧 Optimizing React Performance with Redux and React Hooks


📈 28.23 Punkte
🔧 Programmierung

🔧 Optimizing React Performance with Redux and React Hooks


📈 28.23 Punkte
🔧 Programmierung

🔧 Optimizing React Performance with Redux and React Hooks


📈 28.23 Punkte
🔧 Programmierung

🔧 Form Validation in React: An In-Depth Tutorial with Hooks and React Hook Form


📈 28.23 Punkte
🔧 Programmierung

🔧 This Week In React #185: React Conf, React Query, refs, Next.js after, mini-react...


📈 28.2 Punkte
🔧 Programmierung

🔧 This Week In React #185: React Conf, React Query, refs, Next.js after, mini-react...


📈 28.2 Punkte
🔧 Programmierung

🔧 Flutter Hooks Tutorial: Flutter Animation Using Hooks (useEffect and useAnimationController)


📈 26.59 Punkte
🔧 Programmierung

🔧 Revolutionizing React: Unveiling the New Hooks in React 19🚀


📈 26.56 Punkte
🔧 Programmierung

🔧 Unlocking React's Power: Understanding React's Core Hooks


📈 26.56 Punkte
🔧 Programmierung

🔧 Easy Customizable Star Rating Component in React


📈 24.18 Punkte
🔧 Programmierung

🔧 React: About highly customizable components - P1


📈 24.18 Punkte
🔧 Programmierung

🔧 Highly Customizable React Custom Select Box Component


📈 24.18 Punkte
🔧 Programmierung

🔧 Customizable rules for Prettier + Eslint in React


📈 24.18 Punkte
🔧 Programmierung

🔧 Enhance Your React Applications with Customizable Magic Mouse Cursors Using `magicmouse.ts`


📈 24.18 Punkte
🔧 Programmierung

🔧 Unraveling the Mysteries of JavaScript and React: Hooks, Callbacks, and Methods


📈 22.84 Punkte
🔧 Programmierung

🔧 What’s New in React 19? React Canaries, Actions, and React Compiler


📈 22.82 Punkte
🔧 Programmierung

🐧 On Open Source Principles: On Software Complexity and Open Source.


📈 21.57 Punkte
🐧 Linux Tipps

🐧 Solving the Open Source Funding problem or how Free and Open Source Software can FINALLY be free!


📈 21.57 Punkte
🐧 Linux Tipps

matomo