Giter Site home page Giter Site logo

hooks's Introduction

commitd

Committed commitd

hooks's People

Contributors

dependabot[bot] avatar stuarthendren avatar

Stargazers

 avatar

Watchers

 avatar  avatar

hooks's Issues

Storybook missing the Introduction mdx page

This happens after update to 6.4.22, builds but doesn't have the Introduction in.
On yarn storybook same issue but saving causes build to get stuck on the Introduction page.

API or "Fetch" hook

Feature Request

I was wondering if a general useFetch or some API calling hook was a sensible idea. I feel its something that I constantly rewrite. The whole useAPI that then returns loading, error and the result.

General idea being it would be a useEffect that calls fetch on some url with parameters. Im not sure what the right level of granularity would be. (If it should be something like)

interface ApiResult<R>{
  result: R
  loading: boolean
  error?: string
}

useAPI<T,R>(url: string, type: "POST" | "GET", body?: T): ApiResult<R>

Or if its more sensible to split it into useGet or usePost etc (if there are too many arguments on fetch to have one hook)

Add hook for merging refs

What are you trying to achieve?

Common requirement for lib writing, internal ref used but want to allow the supply of a ref via forwardRef.

Remove tsdx

What problem do you want to solve?

tsdx no longer maintained

What do you think is the correct solution to this problem?

tsdx should be removed

useDebounce storybook api requests not working

What happened?

the storybook should demo debounces api requests but they are not working.
looks like the API may no longer be available.

What did you expect to happen?

The api requests should be made.

Modal

Extremely simple, but one which might be useful (components depending):

import { useCallback, useState } from "react"

export function useModal(
  shown: boolean = false
): [boolean, () => void, () => void] {
  const [visible, setVisible] = useState(shown)
  const hide = useCallback(() => setVisible(false), [setVisible])
  const show = useCallback(() => setVisible(true), [setVisible])
  return [visible, hide, show]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.