Skip to content

Commit

Permalink
+ useCrossTabs hook
Browse files Browse the repository at this point in the history
+ `useCrossTabsMessage` hook
+ `useDetectMultiTabs` hook
+ `useEffect2` hook
+ `useIsFirstRender` hook
~ upgraded ts-library-template (yarn -> pnpm, deps, support for paths, etc.)
~ fixed demos not running
~ fixed react and react-dom being in dependencies
  • Loading branch information
dzek69 committed Aug 26, 2023
1 parent 11011ea commit 56fc497
Show file tree
Hide file tree
Showing 23 changed files with 777 additions and 197 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
The format is based on [EZEZ Changelog](https://ezez.dev/guidelines/changelog)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [UNRELEASED]
(nothing yet)

## [1.1.3+]
## [1.2.0] - 2023-08-26
### Added
- `useCrossTabs` hook
- `useCrossTabsMessage` hook
- `useDetectMultiTabs` hook
- `useEffect2` hook
- `useIsFirstRender` hook
### Dev
- upgraded ts-library-template (yarn -> pnpm, deps, support for paths, etc.)
- fixed demos not running
- fixed react and react-dom being in dependencies

## [1.1.3] - 2023-07-03
### Fixed
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
React hooks like no other! ⚡

Use alongside other great libraries, there are no plans to reproduce all "common" hooks.
If a hook is there, it's either unique, rare or super optimized.
If a hook is there, it's either unique, rare, super optimized or just needed for other hooks.

## Features:

- 💪 `useConditionalHooks` - break the rules (safely) — call a dynamic list of hooks conditionally
- 💪 `useConditionalHooks` - break the rules (safely) — call hooks conditionally, use a dynamic list of hooks
- 🪄 `useEffect2` - `useEffect` that gives you previous values
-`useBusy` - keep track of your async operations
- 📨 `useCrossTabs` - hook for cross-tab communication
- 📨 `useCrossTabsMessage` - easily listen to messages from other tabs
- 2️⃣ `useDetectMultiTabs` - detect if there are multiple tabs of your app open
- 🔄 `useForceUpdate` - force render on demand
- 🌐 `useGeolocation` - keep track of user's geolocation (super optimized)
- 🌐 `useSimpleGeolocation` - keep track of user's geolocation (simplified)
- ☝️ `useInputDevice` - keep track of a currently active input device
- 🥇 `useIsFirstRender` - keep track of first render
- 📅 `useToday` - keep track of day changes
- 🔄 `useUpdateEvery` - force render every interval set

Expand All @@ -29,6 +34,8 @@ If a hook is there, it's either unique, rare or super optimized.

- **How to call hooks conditionally** - the only solution that takes care of the pitfalls
- **React Hook is Called Conditionally [SOLVED]**
- **useEffect previous value**
- **useEffect list of changes**

## License

Expand Down
14 changes: 14 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,no-param-reassign
config.resolve.extensionAlias = {
".js": [".ts", ".tsx", ".js"],
};

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return config;
},
};

module.exports = nextConfig;
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ezez/hooks",
"version": "1.1.3+",
"version": "1.2.0",
"repository": "[email protected]:dzek69/ezez-hooks.git",
"author": "Jacek Nowacki",
"license": "MIT",
Expand Down Expand Up @@ -33,8 +33,7 @@
"types": "./esm/index.d.ts",
"module": "./esm/index.js",
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"oop-timers": "^5.0.0"
},
"devDependencies": {
"@babel/core": "^7.22.8",
Expand All @@ -45,7 +44,7 @@
"@dzek69/eslint-config-import-typescript": "^1.0.1",
"@dzek69/eslint-config-react": "^1.2.2",
"@dzek69/eslint-config-typescript": "^1.1.1",
"@ezez/utils": "^1.8.0",
"@ezez/utils": "^1.9.0",
"@knodes/typedoc-plugin-pages": "^0.23.4",
"@types/jest": "^29.5.2",
"@types/react": "^18.2.8",
Expand All @@ -62,14 +61,19 @@
"husky": "^8.0.3",
"jest": "^29.6.1",
"must": "^0.13.4",
"next": "^13.4.9",
"nodemon": "^2.0.22",
"next": "^13.4.19",
"nodemon": "^3.0.1",
"prettier": "^2.8.8",
"sass": "^1.35.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"resolve-tspaths": "^0.8.14",
"ts-node": "^10.9.1",
"typedoc": "^0.23.28",
"typescript": "^5.1.3",
"resolve-tspaths": "^0.8.14"
"typescript": "^5.1.3"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit 56fc497

Please sign in to comment.