をレンダリングされないし、私の周り私の頭を取得しようとしていますいくつかの理由で私のネストされたルートが表示されませんので、ルーターを反応し、それが今までうまくいきました。は、ルータに反応 - ネストされたルートは、私は現在ReactJSで開発してい
基本的に '/ home'にナビゲートすると、NavBarをレンダリングし、その下にレンダリングメッセージを表示しますが、何らかの理由でNavBarのみがレンダリングされます。どこが間違っていますか?
下記のコードサンプルを参照してください。
ありがとうございました。
ReactDOM.render((
<Router history={hashHistory}>
<Route path="/" component={Login}/>
<Route path="/signup" component={Signup}/>
<Route path="/companyregistration" component={CompanyRegistration}/>
<Route path="/adduserdetails" component={AddUserDetails}/>
<Route component={NavBar}>
<Route path="/home" component={Welcome} />
</Route>
</Router>
), document.getElementById("app"))
EDIT - ナビゲーションバー:
export default React.createClass({
render() {
return (
<div>
<AppBar
showMenuIconButton={false}
title={<img src={"img/logo-nav.png"}/>}
iconElementRight={
<RaisedButton
onClick={signOut}
label="Sign Out"
primary={true}
style={styles.button}
icon={
<FontAwesome
className='super-crazy-colors'
name='sign-out'
style={{ color: '#B71C1C' }}
/>
}
/>
}
/>
{console.log(this.props.children)}
<div>{this.props.children}</div>
</div>
);
}
});
まだ何もレンダリングされませんが、にconsole.log(this.props.children)は、コンソールに '未定義' 戻っています。
私はnavbar.jsのコードを追加しましたが、this.props.childrenの実装方法を教えてください。これは非常に新しい、申し訳ありません。私はコンストラクタを作成する必要があることを知っていますが、私はこれについてどうやって行くのか分かりません。 –
NavBarのレンダリング方法では、これはちょうどどこかにあります: '
@ Jayce444これでやったことがあります。コンパイルエラーはありませんが、{console.log(this.props.children)}はコンソールに「未定義」を返しています。どこが間違っているのか分かりません。 –