react-router-migration-helper
a migration helper for react router 3 to 4
Last updated 9 months ago by longcha .
MIT · Original npm · Tarball · package.json
$ cnpm install react-router-migration-helper 
SYNC missed versions from official npm registry.

TODO

  • deal with splat
  • deal with baseUrl replacement

Try out

install

npm install -g react-router-migration-helper

migrate ( ⚠️: Do not misspell the command by rm )

rrm ./router.js

# the result will show in result.js

Demo

import Layout from './routes/Layout';
import Projects from './routes/Dashboard/Projects';

export default (
  <Router>
    <Route path="/" component={Layout}>
      <IndexRoute component={Projects} navPathEnd="dashboard/projects" />
      <Route
        path="dashboard"
        breadcrumbName="dashboard"
        navPathEnd="dashboard/projects"
      >
        <IndexRoute component={Projects} />
        <Route path="projects" breadcrumbName="projects" component={Projects}>
          <IndexRoute breadcrumbName="your" />
          <Route path="starred" breadcrumbName="starred" />
          <Route path="all" breadcrumbName="all" />
        </Route>
      </Route>
    </Route>
  </Router>
)

result.js:

export default {
  "path": "/",
  "component": "./routes/Layout",
  "indexRoute": {
    "component": "./routes/Dashboard/Projects",
    "navPathEnd": "dashboard/projects"
  },
  "routes": [
    {
      "path": "dashboard",
      "indexRoute": {
        "component": "./routes/Dashboard/Projects"
      },
      "routes": [
        {
          "path": "projects",
          "component": "./routes/Dashboard/Projects",
          "indexRoute": {
            "breadcrumbName": "your"
          },
          "routes": [
            {
              "path": "starred",
              "breadcrumbName": "starred"
            },
            {
              "path": "all",
              "breadcrumbName": "all"
            }
          ],
          "breadcrumbName": "projects"
        }
      ],
      "breadcrumbName": "dashboard",
      "navPathEnd": "dashboard/projects"
    }
  ]
}

Current Tags

  • 1.0.5                                ...           latest (9 months ago)

6 Versions

  • 1.0.5                                ...           9 months ago
  • 1.0.4                                ...           9 months ago
  • 1.0.3                                ...           9 months ago
  • 1.0.2                                ...           9 months ago
  • 1.0.1                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 5
Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |