0
這是我反應過來的代碼Home
組件反應,不能通過道具一個新的水平
import React, { Component, PropTypes } from 'react';
import Header from '../components/Header'
class Home extends Component {
constructor(props){
super(props);
}
render() {
return (
<div className='container'>
<Header authenticated={true} email='[email protected]'/>
</div>
);
}
}
export default Header;
這是我header
組件
import React, { Component, PropTypes } from 'react';
class Header extends Component {
constructor(props){
super(props);
}
signOut =() => {
}
get combination() {
debugger
if(this.props.authenticated){
return (<ul className='nav nav-pills pull-right'>
<li role='presentation' >Welcome {this.props.email} </li>
<li role='presentation'><a onClick={this.signOut} >Sign out</a></li>
</ul>);
}else{
return(
<ul className='nav nav-pills pull-right'>
<li role='presentation' className='active' ><a href='/sign_up'>Sign up</a></li>
<li role='presentation'><a href='/sign_in' >Sign In</a></li>
</ul>
);
}
}
render() {
return (
<div className="header clearfix">
<nav>
{ this.combination}
</nav>
</div>
);
}
}
export default Header;
怎麼進來Header
組件都this.props.authenticated
和this.props.email
是undefined
?