{navLinks.map((link) => {
const isActive = pathname.startsWith(link.href);
return (
{link.name}
);
})}
{children}
);
}
```
In `src/app/(auth)/style.css`
```css
a {
margin: 0 1rem;
color: blue;
}
a.active-link {
color: black;
}
```
**Navigating Programitically**
- Instead of using jsx, javascript can be used too so for that we can use the hook ie `useRouter` from 'next/navigation'.
Structure
```text
src/app
order-product
page.jsx
page.jsx
```
In `src/app/order-product/page.jsx`
```jsx
"use client";
import { useRouter } from "next/navigation";
export default function OrderProduct() {
const router = useRouter();
const handleClick = () => {
console.log("order placed");
router.push("/");
};
return (
<>
setInput(e.target.value)}
/>
{navLinks.map((link) => {
const isActive = pathname.startsWith(link.href);
return (
{link.name}
);
})}
{children}
);
}
```
When we move to new route input will be same and wont be reset.
**With templates**
Just change the file name from layout.jsx to template.jsx and now input will be reset and nothing will be preserved.
Some limitations though. If there is a route group(say named inner-auth) like this
Structure
```text
src/app
(auth)
(inner-auth)
login
password
forgot-password
template.jsx
style.css
page.jsx
```
In this case, states between `login` and `password` routes will be shared not with `forget-password` route though.
**Loading UI**
- Till now different files like `page.jsx`, `layout.jsx`, `not-found.jsx` and `template.jsx` have been used. There is another one ie `loading.jsx`.
Structure
```text
src/app
blog
first
second
loading.jsx
layout.jsx
page.jsx
page.jsx
```
In `src/app/blog/loading.jsx`
```jsx
export default function LoadingBlog() {
return (