나는이 같은 레이아웃을 가질 수 있습니다 생각 : 당신이해야합니다
<App>
<Navbar /> { /* Here you show the username also, this view will depend on props */ }
<Layout /> { /* Here you may have the content and the sidenav */ }
</App>
앱 상단 구성 요소 인) (렌더링 예를 들면 소품을 통과하는 주요 컨테이너를
// You should treat this as a Page component, the one that grabs
// data and passes it as props to another components
export default class AppPage extends React.Component {
render() {
return (<AppLayout { ...this.props } />);
}
}
export default class AppLayout extends React.Component {
render() {
return (
<Navbar someProp={ this.props.someProp } />
{ this.props.children }
);
}
}
라우터는 예를 들면 될 수 있습니다
<Router history={ browserHistory }>
<Route path="/" component={ App }>
<IndexRoute component={ Landing } />
<Route path="/index" component={ Layout } />
</Route>
</Router>
IndexRoute가 '/'이며 구성 요소를 저희해야하는 말할 수있다 예를 들어,/layout {this.props. children} AppLayout에 <Layout />
구성 요소로 렌더링합니다.
나는이 기사를 읽으십시오 : https://facebook.github.io/react/docs/thinking-in-react.html 더 나은 작품을 어떻게 반응하는지 이해하는 ... 그것은 그것은 Navbar의 구성 요소에 있어야
1 도움을 바랍니다. 2. 반응 라우터가 좋은 선택이지만 체크 아웃 할 수있는 다른 방법이 있습니다. 3. 많은 유동체에 대해 잘 모르겠다. 아마도 GitHub 문서를 읽어야 할 것이다. 4. 특정 유형의 작업을 수행 할 때 React에는 구성 요소에 대한 '콜백'이 있으므로 componentDidMount가 $ .get 일 때 $ .get을 만들 수 있습니다. 5. Redux는 상태가 어떻게 바뀌는 지 설명하는 감속기입니다. 더 고급입니다.하지만 시작하면 복잡한 것처럼 보일 수도 있습니다. – MiGu3X
탐색 값을 통과해야하는 경우 어떻게해야합니까? 예를 들어 현재 표시된 데이터를 필터링하는 "연도"필터 일 수 있습니까? 나는 이것을 위해 Context를 사용합니까? – Nsevens