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

https://github.com/devnax/react-pagex


https://github.com/devnax/react-pagex

Last synced: about 1 year ago
JSON representation

Awesome Lists containing this project

README

          

## React PageX

The `react-pagex` is a very tiny library for manage react app routes. It's very simple to use.

### Availabel Hooks and Components

```js
import {
Link,
useRoute,
useGroup,
useQuery,
Navigate,
Route,
Routes,
Parser
} from 'react-pagex'

```

### Useg

```jsx
import {Link, Routes, Route} from 'react-pagex'

const Home = ({params, query}) => {
return

Home


}
const About = ({params, query}) => {
return

About


}

const Contact = ({params, query}) => {
return

Contact


}

export default () => {
return (
{

}}
>












)
}

```

### Link Component

```jsx

const LinkComp = ({children, ...props}) =>

{children}

// With Children
Children

```

### Routes Component
`Routes` used the useGroup hook
```jsx
{

}}
onFound={(route) => {

}}
>
children

```

### Route Component
`Route` used the useRoute hook
```jsx

```

### Navigate
Navigate Page without `Link` Component

```js
import {Navigate} from 'react-pagex'

Navigate.go('/path')
Navigate.back()
Navigate.forward()
Navigate.reload()

```

### useGroup

```js
const App = () => {
useGroup({
basepath: '',
onError: () => {},
onFound: () => {},
})

return <>app>
}

```

### useRoute

```js
const App = () => {
const params = useRoute('/path')
if(params){
return

Route Match

}
return <>>
}

```

### useQuery
Just get the current route query with an object

### Parser
The `Parser` is a module for match and parse the route
```js
const params = Parser.isMatch('/path/:id', 'compare path')
```