RubyLouvre / anu

the React16-compat library with hooks

Home Page:https://rubylouvre.github.io/anu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

使用@reach/router嵌套路由的问题

huangxinxia opened this issue · comments

const Home = () => (
  <div>
    <h2>Dashboard</h2>
    <nav>
      <span onClick={() => navigate('/home/bizSetLog')}>team</span>
      <span onClick={() => navigate('/home/bizSetOrgGroup')}>projects</span>
    </nav>
    <Router>
      <ServiceLog path="bizSetLog/*" />
      <GroupSet path="bizSetOrgGroup/*" />
    </Router>
  </div>
);
const ServiceLog = () => (
  <div>
    <Router>
      <Index11 path="/" />
    </Router>
  </div>
);
const GroupSet = () => (
  <div>
    <Router>
      <Index22 path="/" />
    </Router>
  </div>
);
const Index11 = () => (1111);
const Index22 = () => (2222);
ReactDOM.render(
  <div>
    <div>
      <Link to="home">---home---</Link>
    </div>
    <Router>
      <Home path="home/*" />
    </Router>
  </div>,
  document.getElementById('root'),
);

这是一个很简单的3层嵌套的路由,从/home/bizSetLog切换到/home/bizSetOrgGroup,Index22 这个组件不显示。
我换成react,是可以正常切换的