1.8.2 • Published 7 years ago

mobx-little-router-react v1.8.2

Weekly downloads
37
License
MIT
Repository
github
Last release
7 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

7 years ago

1.8.1

7 years ago

2.0.0-20

7 years ago

2.0.0-19

7 years ago

2.0.0-18

7 years ago

2.0.0-17

7 years ago

2.0.0-16

7 years ago

2.0.0-14

7 years ago

2.0.0-10

7 years ago

2.0.0-9

7 years ago

2.0.0-5

7 years ago

2.0.0-4

7 years ago

2.0.0-3

7 years ago

2.0.0-2

7 years ago

2.0.0-1

7 years ago

2.0.0-0

7 years ago

1.8.0

7 years ago

1.7.5

7 years ago

1.7.4

7 years ago

1.7.3

7 years ago

1.7.2

7 years ago

1.7.0-2

8 years ago

1.7.0-1

8 years ago

1.7.0-0

8 years ago

1.6.10

8 years ago

1.6.8

8 years ago

1.6.7

8 years ago

1.6.6

8 years ago

1.6.5

8 years ago

1.6.4

8 years ago

1.6.3

8 years ago

1.6.2

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.5.0-19

8 years ago

1.5.0-18

8 years ago

1.5.0-17

8 years ago

1.5.0-16

8 years ago

1.5.0-15

8 years ago

1.5.0-13

8 years ago

1.5.0-12

8 years ago

1.5.0-11

8 years ago

1.5.0-9

8 years ago

1.5.0-8

8 years ago

1.5.0-7

8 years ago

1.5.0-6

8 years ago

1.5.0-5

8 years ago

1.5.0-4

8 years ago

1.5.0-3

8 years ago

1.5.0-2

8 years ago

1.5.0-1

8 years ago

1.5.0-0

8 years ago

1.4.5

8 years ago

1.4.4

8 years ago

1.4.3

8 years ago

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

1.0.0-rc.9.1.0

8 years ago

1.0.0-beta.1.4

8 years ago

1.0.0-beta.1.3

8 years ago

1.0.0-beta.1.2

8 years ago

1.0.0-beta.1.1

8 years ago

1.0.0-beta.1.0

8 years ago

1.0.0-rc27.0

8 years ago

1.0.0-rc26.0

8 years ago

1.0.0-rc25.0

8 years ago

1.0.0-rc24.0

8 years ago

1.0.0-rc23.0

8 years ago

1.0.0-rc22.0

8 years ago

1.0.0-rc21.0

8 years ago

1.0.0-rc20.0

8 years ago

1.0.0-rc19.0

8 years ago

1.0.0-rc18.0

8 years ago

1.0.0-rc17.0

8 years ago

1.0.0-rc16.0

8 years ago

1.0.0-rc15.0

8 years ago

1.0.0-rc14.0

8 years ago

1.0.0-13.0

8 years ago

1.0.0-rc12.0

8 years ago

1.0.0-rc11.0

8 years ago

1.0.0-rc10.0

8 years ago

1.0.0-rc9.0

8 years ago

1.0.0-rc8.0

8 years ago

1.0.0-rc7.0.0

8 years ago

1.0.0-rc1

8 years ago

0.9.5

8 years ago

0.9.4

8 years ago