react-link-interceptor 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +36 -0
  2. package/package.json +4 -3
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # react-link-interceptor
2
+
3
+ React hook to intercept all `<a>` tag clicks in your SPA. Handle internal routing and external link modifications with ease.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install react-link-interceptor
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import { useLinkInterceptor } from 'react-link-interceptor'
15
+
16
+ function App() {
17
+ useLinkInterceptor({
18
+ onInternalLink(ctx) {
19
+ ctx.preventDefault()
20
+ navigate(ctx.path) // react-router
21
+ },
22
+ onExternalLink(ctx) {
23
+ ctx.url.searchParams.set('utm_source', 'myapp')
24
+ },
25
+ })
26
+ return <div>...</div>
27
+ }
28
+ ```
29
+
30
+ ## Docs & Playground
31
+
32
+ https://babu-ch.github.io/link-interceptor/?fw=react
33
+
34
+ ## License
35
+
36
+ [MIT](https://github.com/babu-ch/link-interceptor/blob/main/LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-link-interceptor",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "React hook to intercept all <a> tag clicks in your SPA — handle internal routing and external link modifications with ease.",
5
5
  "keywords": [
6
6
  "anchor",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "author": "babu-ch",
15
15
  "license": "MIT",
16
- "homepage": "https://github.com/babu-ch/link-interceptor/tree/main/packages/react",
16
+ "homepage": "https://babu-ch.github.io/link-interceptor/?fw=react",
17
17
  "repository": {
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/babu-ch/link-interceptor.git",
@@ -27,6 +27,7 @@
27
27
  "node": ">=18.0.0"
28
28
  },
29
29
  "files": [
30
+ "README.md",
30
31
  "dist"
31
32
  ],
32
33
  "type": "module",
@@ -56,7 +57,7 @@
56
57
  "react-dom": "^19.0.0",
57
58
  "typescript": "^5.8.2",
58
59
  "vite-plus": "^0.1.14",
59
- "link-interceptor": "0.1.0"
60
+ "link-interceptor": "0.1.2"
60
61
  },
61
62
  "scripts": {
62
63
  "build": "vp pack",