Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TimMikeladze committed May 23, 2024
1 parent 57e7662 commit 9ba5358
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Finally, let's write some code to use the `next-flag` package.
```ts
// src/app/api/next-flag/nf.ts
import { NextFlag } from 'next-flag';
import { revalidateTag, unstable_cache } from 'next/cache';

export const nf = new NextFlag({
paths: [
Expand All @@ -93,6 +94,10 @@ export const nf = new NextFlag({
issue: 123,
},
],
cache: {
revalidateTag,
unstable_cache,
},
});
```

Expand Down Expand Up @@ -249,6 +254,7 @@ NEXT_PUBLIC_NEXT_FLAG_ENDPOINT="https://<YOUR_DOMAIN>/api/next-flag"
```ts
// src/app/api/next-flag/nf.ts
import { NextFlag } from 'next-flag';
import { revalidateTag, unstable_cache } from 'next/cache';

export const nf = new NextFlag({
paths: [
Expand All @@ -263,6 +269,10 @@ export const nf = new NextFlag({
issue: 124,
},
],
cache: {
revalidateTag,
unstable_cache,
},
});
```

Expand Down
9 changes: 5 additions & 4 deletions examples/nextjs-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
"lint": "next lint"
},
"dependencies": {
"next": "14.2.3",
"next-flag": "^0.0.1",
"react": "^18",
"react-dom": "^18",
"next": "14.2.3"
"react-dom": "^18"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.3"
"eslint-config-next": "14.2.3",
"typescript": "^5"
}
}
153 changes: 153 additions & 0 deletions examples/nextjs-example/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions examples/nextjs-example/src/app/api/next-flag/nf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NextFlag } from 'next-flag';
import { revalidateTag, unstable_cache } from 'next/cache';

export const nf = new NextFlag({
paths: [
Expand All @@ -7,4 +8,8 @@ export const nf = new NextFlag({
issue: 3,
},
],
cache: {
revalidateTag,
unstable_cache,
},
});

0 comments on commit 9ba5358

Please sign in to comment.