Skip to content

Commit

Permalink
chore(playground): add loader error and route error routes
Browse files Browse the repository at this point in the history
  • Loading branch information
mcansh committed Jun 29, 2024
1 parent e1a8907 commit ddbdf4a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 44 deletions.
62 changes: 23 additions & 39 deletions examples/playground/app/routes/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { NavLink, Outlet } from "@remix-run/react";

let LINKS = [
{ to: "/", label: "Home" },
{ to: "/page-2", label: "Page 2" },
{ to: "/fetcher", label: "Fetcher" },
{ to: "loader-error", label: "Loader Error" },
{ to: "route-error", label: "Route Error" },
] as const;

export default function Layout() {
return (
<div>
Expand Down Expand Up @@ -43,45 +51,21 @@ export default function Layout() {
alignItems: "center",
}}
>
<li>
<NavLink
style={({ isActive }) => {
return {
color: isActive ? "red" : "blue",
textDecoration: isActive ? "underline" : "none",
};
}}
to="/"
>
Home
</NavLink>
</li>
<li>
<NavLink
style={({ isActive }) => {
return {
color: isActive ? "red" : "blue",
textDecoration: isActive ? "underline" : "none",
};
}}
to="/page-2"
>
Page 2
</NavLink>
</li>
<li>
<NavLink
style={({ isActive }) => {
return {
color: isActive ? "red" : "blue",
textDecoration: isActive ? "underline" : "none",
};
}}
to="/fetcher"
>
Fetcher
</NavLink>
</li>
{LINKS.map((link) => (
<li key={link.to}>
<NavLink
to={link.to}
style={({ isActive }) => {
return {
color: isActive ? "red" : "blue",
textDecoration: isActive ? "underline" : "none",
};
}}
>
{link.label}
</NavLink>
</li>
))}
</ul>
</nav>
</header>
Expand Down
5 changes: 0 additions & 5 deletions examples/playground/app/routes/error.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions examples/playground/app/routes/loader-error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { unstable_defineLoader as defineLoader } from "@remix-run/node";

export const loader = defineLoader(async () => {
throw new Error("This is an error");
});
3 changes: 3 additions & 0 deletions examples/playground/app/routes/route-error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function foo() {
throw new Error("This is an error");
}

0 comments on commit ddbdf4a

Please sign in to comment.