1.8.2 • Published 6 years ago

mobx-little-router-react v1.8.2

Weekly downloads
37
License
MIT
Repository
github
Last release
6 years ago

mobx-router-react

Usage

  import React from 'react'
  import ReactDOM from 'react-dom'
  import { createBrowserHistory } from 'history'
  import { install, RouterProvider, Outlet } from 'mobx-little-router-react'
  import { install } from 'mobx-little-router-react'

  // Note that <Outlet/> is rendered at the App component level.
  // This will allow any matched child route to also be rendered.
  // If you need to block child rendering you can do that by not rendering
  // the <Outlet/> element.
  const App = () => (
    <div>
      <header>Acme Inc.</header>
      <Outlet/>
    </div>
  )

  const Home = () => (
    <div>
      <h1>Home</h1>
    </div>
  )

  const About = () => (
    <div>
      <h1>About</h1>
    </div>
  )

  install({
    history: createBrowserHistory(),
    routes: [
      { path: '', component: Home },
      { path: 'about', component: About }
    ]
  })

  router.start(() => {
    ReactDOM.render(
      <RouterProvider router={router}>
        <App />
      </RouterProvider>,
      document.getElementById('root')
    )
  })

Components

RouterProvider

Provides the router context

Link

Used to navigate

Outlet

Used to render routes at each depth.

Decorators

withRouter

injects router context into component props.

Configuration

component ReactComponent

A react component to render when the route is matched

outlet string

An optional named outlet to render this route into, ie. 'modal'

animate boolean, default: false

Do you wish to use built in animation features for this route. Specify a data-transition-ref attribute on the node you are animating otherwise the Component root node will be used for detecting the transitionend event.

1.8.2

6 years ago

1.8.1

6 years ago

2.0.0-20

6 years ago

2.0.0-19

6 years ago

2.0.0-18

6 years ago

2.0.0-17

6 years ago

2.0.0-16

6 years ago

2.0.0-14

6 years ago

2.0.0-10

6 years ago

2.0.0-9

6 years ago

2.0.0-5

6 years ago

2.0.0-4

6 years ago

2.0.0-3

6 years ago

2.0.0-2

6 years ago

2.0.0-1

6 years ago

2.0.0-0

6 years ago

1.8.0

6 years ago

1.7.5

6 years ago

1.7.4

6 years ago

1.7.3

6 years ago

1.7.2

6 years ago

1.7.0-2

6 years ago

1.7.0-1

6 years ago

1.7.0-0

6 years ago

1.6.10

6 years ago

1.6.8

6 years ago

1.6.7

6 years ago

1.6.6

6 years ago

1.6.5

6 years ago

1.6.4

7 years ago

1.6.3

7 years ago

1.6.2

7 years ago

1.6.1

7 years ago

1.6.0

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.5.0-19

7 years ago

1.5.0-18

7 years ago

1.5.0-17

7 years ago

1.5.0-16

7 years ago

1.5.0-15

7 years ago

1.5.0-13

7 years ago

1.5.0-12

7 years ago

1.5.0-11

7 years ago

1.5.0-9

7 years ago

1.5.0-8

7 years ago

1.5.0-7

7 years ago

1.5.0-6

7 years ago

1.5.0-5

7 years ago

1.5.0-4

7 years ago

1.5.0-3

7 years ago

1.5.0-2

7 years ago

1.5.0-1

7 years ago

1.5.0-0

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

1.0.0-rc.9.1.0

7 years ago

1.0.0-beta.1.4

7 years ago

1.0.0-beta.1.3

7 years ago

1.0.0-beta.1.2

7 years ago

1.0.0-beta.1.1

7 years ago

1.0.0-beta.1.0

7 years ago

1.0.0-rc27.0

7 years ago

1.0.0-rc26.0

7 years ago

1.0.0-rc25.0

7 years ago

1.0.0-rc24.0

7 years ago

1.0.0-rc23.0

7 years ago

1.0.0-rc22.0

7 years ago

1.0.0-rc21.0

7 years ago

1.0.0-rc20.0

7 years ago

1.0.0-rc19.0

7 years ago

1.0.0-rc18.0

7 years ago

1.0.0-rc17.0

7 years ago

1.0.0-rc16.0

7 years ago

1.0.0-rc15.0

7 years ago

1.0.0-rc14.0

7 years ago

1.0.0-13.0

7 years ago

1.0.0-rc12.0

7 years ago

1.0.0-rc11.0

7 years ago

1.0.0-rc10.0

7 years ago

1.0.0-rc9.0

7 years ago

1.0.0-rc8.0

7 years ago

1.0.0-rc7.0.0

7 years ago

1.0.0-rc1

7 years ago

0.9.5

7 years ago

0.9.4

7 years ago