An open API service indexing awesome lists of open source software.

https://github.com/devjubayr/react_router_tutorial


https://github.com/devjubayr/react_router_tutorial

Last synced: 6 days ago
JSON representation

Awesome Lists containing this project

README

          

# React router Tutorial Nodes

- This repository show what I learned from react router official tutorial.
- I've added what I learned from the tutorial.

[React Router v6 tutorial](https://reactrouter.com/6.30.1/start/tutorial)

## Important hooks

- **useRouteError:** useRouteError provides the error that was thrown. When the user navigates to routes that don't exist you'll get an error response with a "Not Found" statusText.

- **Form:** Unlike HTML form, react router form also work same but use client side routing.
Props:
1. _method_: "post", "put", "patch"
2. id:
3. _action_: "destroy" (this point to destroy like a link path to="destroy")
- **redirect:** to redirect from anywhere, Note that **useNavigate** only use in component and hooks
- **useNavigation:** to add global pending UI. _useNavigation returns the current navigation state: it can be one of "idle" | "submitting" | "loading"_


div start
className={
navigation.state === "loading" ? "loading" : ""
}
{Outlet here}
div close "

**useFetcher:** allows us to communicate with loaders and actions without causing a navigation.