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

https://github.com/shy2850/ipreact-router

ipreact-router
https://github.com/shy2850/ipreact-router

Last synced: 3 months ago
JSON representation

ipreact-router

Awesome Lists containing this project

README

        

# ipreact-router
ipreact-router

### usage

`npm i ipreact-router`

```tsx
import { h, Component, render } from 'preact'
import { Router, Route, Link } from './ipreact-router'
import { createHashHistory } from 'history'

interface Com2Props {params: {title: string}}

class App extends Component {
com1 = () =>

com1

com2 = ({params}: Com2Props) =>
com2: {params.title}

com3 = () =>
com3

com404 = () =>

404



history = createHashHistory()
state = {pathname: this.history.location.pathname}
componentDidMount () {
const t = this;
t.history.listen((location) => {
t.setState({
pathname: location.pathname
})
})
}
render () {
const { pathname } = this.state
return


com1
com2
com2/heheda
com3
com3/sub









}
}

render(, document.getElementById('app'))
```