This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"next-static-paths": patch | ||
--- | ||
|
||
add a readme to the npm package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# `next-static-paths` | ||
|
||
Statically prevent HTTP 404 Not Found in your Next.js applications using TypeScript and code generation. | ||
|
||
## Usage | ||
|
||
```sh-session | ||
$ pnpm add next-static-paths | ||
# or | ||
$ yarn add next-static-paths | ||
# or | ||
$ npm install next-static-paths | ||
``` | ||
|
||
Then, from within your Next.js application root, run the following command: | ||
|
||
```sh-session | ||
# For pnpm users | ||
$ pnpx next-static-paths | ||
|
||
# For yarn users | ||
$ yarn next-static-paths | ||
|
||
# For npm users | ||
$ npx next-static-paths | ||
``` | ||
|
||
### `TypedLink` component | ||
|
||
```tsx | ||
import { TypedLink } from "next-static-paths"; | ||
function MyComponent() { | ||
return ( | ||
<TypedLink as="/some/[myArgument]" myArgument="hello world"> | ||
<a>Hello world</a> | ||
</TypedLink> | ||
); | ||
} | ||
``` | ||
|
||
### `pathFor` helper | ||
|
||
```tsx | ||
import { pathFor } from "next-static-paths"; | ||
|
||
function getPath() { | ||
return pathFor("/some/[myArgument]", { myArgument: "hello world" }); | ||
} | ||
``` |