@shymean/react-vue-router
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

react-vue-router

react-vue 路由组件

const Home = () => {
  return () => {
    return (<div>this is home</div>)
  }
}
const About = () => {
  return () => {
    return (<div>this is about</div>)
  }
}

const routes = [
  {
    path: '/',
    component: Home
  }, {
    path: '/about',
    component: About
  }
]

function App() {
  const history = useHistory()
  
  const toHome = () => {
    history.push('/')
  }
  const toAbout = () => {
    history.push('/about')
  }

  return () => {
    return (<div>
      <div>
        <button onClick={toHome}>to home</button>
        <button onclick={toAbout}>to about</button>
      </div>
      <RouterView routes={routes}/>
    </div>)
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @shymean/react-vue-router

Weekly Downloads

1

Version

1.0.7

License

ISC

Unpacked Size

36.6 kB

Total Files

9

Last publish

Collaborators

  • shymean