Giter Site home page Giter Site logo

heyitsarpit / react-hooks-library Goto Github PK

View Code? Open in Web Editor NEW
364.0 4.0 14.0 2.67 MB

A collection of hooks and utilities for modern React

Home Page: https://react-hooks-library.vercel.app/

License: MIT License

JavaScript 1.48% TypeScript 61.14% CSS 4.79% Shell 0.03% MDX 32.57%
react hooks typescript treeshaking ssr demos

react-hooks-library's Issues

[docs][packages] Build failure due to SSR not working

Various errors related to document and window being undefined. Happended after merging #13 .

Issues encountered in these functions -

  • BreakPointHooks
  • useActiveElement
  • useClickOutside
  • useEventListener
  • useKeyStroke
  • useMediaStream
  • useMutationObserver
  • useRouter
  • useScroll
  • useTitle
  • useWindowSize

[docs] Design and Performance Improvements

  • Add button to open sidebar on mobile
  • make sidebar autocollpsible
  • close sidebar by clicking outside it
  • Make logo smaller on mobile, hide text logo on mobile
  • Higher margin y for code blocks
  • Lower x padding for body on mobile
  • Optimise font loading, use same origin font and caching via swr

[bug] Typescript error on build "ConnectionType"

Hello , I use your library for its BreakPointHooks and I have an issue when trying to build my app :

npm run build                  

> [email protected] build
> tsc && vite build

node_modules/@react-hooks-library/core/index.d.ts:627:21 - error TS2304: Cannot find name 'ConnectionType'.

627     readonly type?: ConnectionType;
                        ~~~~~~~~~~~~~~

node_modules/@react-hooks-library/core/index.d.ts:649:11 - error TS2304: Cannot find name 'ConnectionType'.

649     type: ConnectionType | undefined;
              ~~~~~~~~~~~~~~


Found 2 errors in the same file, starting at: node_modules/@react-hooks-library/core/index.d.ts:627

What could I do to fix it ? I'm using Typescript 5.3.3 on my app btw.

Thanks !

[hooks] Hooks don't return stable functions

Hooks don't currently return stable functions, i.e. the function is recreated on each render and cannot be properly used by user code inside an effect.

Solution - wrap all internal function with useCallback.

useMediaQuery returns updated value after 15px

i am using the useMediaQuery hook.
My code:

   const isDesktopScreen = useMediaQuery('(min-width: 1552px)')

the isDesktopScreen return false at 1537px instead of 1552px.
The useMediaQuery returns updated value after 15px is decreased or increased.

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.