heyitsarpit / react-hooks-library Goto Github PK
View Code? Open in Web Editor NEWA collection of hooks and utilities for modern React
Home Page: https://react-hooks-library.vercel.app/
License: MIT License
A collection of hooks and utilities for modern React
Home Page: https://react-hooks-library.vercel.app/
License: MIT License
Various errors related to document and window being undefined. Happended after merging #13 .
Issues encountered in these functions -
Server side rendering is not working for SEO tags. Related to #8
Tested on IOS Chrome. If you click reset button while nothing is in history, it is breaking the example. It should be disabled like redo button.
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 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
.
useHasMounted Source links go to useScroll source/demo/docs
https://react-hooks-library.vercel.app/core/useHasMounted
useEffectAfterMount
does not currently return clean up function, i.e. user passed clean up function will not run.
Solution - return user passed clean up function.
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.
useEffectAfterMount
does not in React 18's strict mode in development environment, because react first mounts component, which sets isMounted.current
to true
, then unmounts component and mounts again. The problem is that isMounted.current
is true on second mount.
Solution - reset isMounted.current
on unmount.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.