Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanniser committed Mar 14, 2023
1 parent 6a1e8fa commit a603d2c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-ways-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"next-typesafe-url": patch
---

minor edits to docs, and change to the cli message after generating types
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,9 @@ const { data, isValid, isReady, isError, error } = params;

if (!isReady) {
return <div>loading...</div>;
} else if (isError) {
} else if (isError && isReady) {
return <div>Invalid search params {error.message}</div>;
} else {
// isValid === true
} else if (isValid){
return <div>{data.userInfo.name}</div>;
}
```
Expand All @@ -186,7 +185,7 @@ _For convenience, instead of needing checking `isReady && !isError`, I have adde

## Reccomended Usage

**It is reccomended to only call `useSearchParams` and `useRouteParams` in the top level component of each route, and pass the data down to child components through props or context.**
**It is HIGHLY reccomended to only call `useSearchParams` and `useRouteParams` in the top level component of each route, and pass the data down to child components through props or context.**

If you are looking for a easier way to do globally this check out [Jotai](https://jotai.org/).

Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function build() {
getRoutesWithExportedRoute(pagesPath, pagesPath);

generateTypesFile(exportedRoutes, filesWithoutExportedRoutes);
console.log("Generated types.d.ts");
console.log("Generated route types");
}

function watch() {
Expand All @@ -36,7 +36,7 @@ function watch() {
.on("change", () => {
build();
});
console.log("Watching for routes changes...");
console.log("Watching for route file changes...");
}

if (require.main === module) {
Expand Down

0 comments on commit a603d2c

Please sign in to comment.