Document how to do forms, error pages #29
-
I can't find it |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi 👋, There's nothing specific to handle forms or errors, chicane is idiomatic React. Just use forms: Or with the library of your choice: For errors, showing a "not found" page is easy: const App: FC = async () => {
const route = router.useRoute([/* … */]);
switch (route.name) {
case "Root":
return <Root />;
// …
default:
return <NotFound />; // render "not found" when no route match
}
}; Handling other errors is also just idiomatic React: I'm aware a lot of routers tends to make a lot of coupling with other concepts (form handling, data fetching, etc) lately, but the purpose of this library is not to trap you into an ecosystem 😄 Chicane does routing, safely. Doesn't sell you something else. |
Beta Was this translation helpful? Give feedback.
-
Thanks. I think it would be a good idea to have a port of https://reactrouter.com/en/main/start/tutorial to get a feel for what chicane does and how to express everything else in idiomatic react. I think it would be useful to people coming from react-router and trying to port their app. |
Beta Was this translation helpful? Give feedback.
Hi 👋,
There's nothing specific to handle forms or errors, chicane is idiomatic React.
Just use forms:
Or with the library of your choice:
For errors, showing a "not found" page is easy:
Handling other errors is also just idiomatic React: