我的代码出了点问题:
在这种情况下,import React from 'react';
import {Link} from 'react-router';
import CurrentUser from './../services/current-user.js';
import HeaderWithoutLogin from './header-without-login.js';
import HeaderWithLogin from './header-with-login.js';
let Header = React.createClass({
render: () => {
var Child = CurrentUser.isLoggedIn()
? HeaderWithLogin
: HeaderWithoutLogin;
return <div>{Child}</div>;
}
});
export default Header;
import React from 'react';
import {Link} from 'react-router';
import CurrentUser from './../services/current-user.js';
import HeaderWithoutLogin from './header-without-login.js';
import HeaderWithLogin from './header-with-login.js';
let Header = React.createClass({
render: () => {
if (CurrentUser.isLoggedIn()) {
return <HeaderWithLogin/>;
}
return <HeaderWithoutLogin/>;
}
});
export default Header;
我需要如何使用我的逻辑?我的意思是返回并呈现关于语句的不同观点