2017-05-13 10 views
1

작동하지 "/"정확한 경로 라우터 V4 반응하지만 내가 exact 단어를 삭제은 코르도바의 플러그인 IntelXDK에서이 작업을 수행하려고 코르도바

const app = document.getElementById('app'); 

const Index =() => (
    <Router> 
     <div> 
     <Switch> 
      <Route exact path="/" component={Layout}/> 
      <Route path="/about" component={First}/> 
      <Route path="/topics" component={Second}/> 
     </Switch> 
     </div> 
    </Router> 

); 

const Layout =() => (
    <div> 
     <h1>layout</h1> 
     <ul> 
      <li><Link to="/">Home</Link></li> 
      <li><Link to="/about">About</Link></li> 
      <li><Link to="/topics">Topics</Link></li> 
     </ul> 
    </div> 
); 

const First =() => (
    <div> 
     <h1>first</h1> 
    </div> 
); 

const Second =() => (
    <div> 
     <h1>second</h1> 
    </div> 
); 


ReactDOM.render(<Index/>, app); 

하지가 <Switch> 태그를 사용하여 아무것도 표시되지 않습니다 그것은 작동하지만 레이아웃과 첫 번째 또는 두 번째 구성 요소를 렌더링합니다.

하나의 구성 요소 만 렌더링하고 싶습니다. 누군가이 문제를 해결할 수 있습니까?

답변

0

정확한 atteibute를 제거하고/경로를 3 개의 경로 끝에 넣을 수 있습니다. 그럼 다른 것들이 아니라면 그냥 렌더링됩니다. 그러나 그것이 다른 것이라면 렌더링 할 것이기 때문에 당신이 그것을 피하고 싶은지 확실하지 않습니다.

감사합니다.