我正在研究一個反應應用程序,在這個應用程序中,我們在頂部,側面導航欄和頁腳上標題,通常每個應用程序都有它。我的應用程序佈局看起來不太好.top標題很好,但頁面內容總是左側。下面 是我index.js代碼反應佈局看起來不太好
import React ,{ Component } from 'react';
import {render} from 'react-dom';
import { Provider } from 'react-redux';
import { Router, Route, browserHistory, IndexRoute } from 'react-router';
import routes from './routes.jsx';
import injectTapEventPlugin from 'react-tap-event-plugin';
import theme from './material_ui_raw_theme_file.jsx';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import NotFoundPage from './staticComponents/NotFoundPage.jsx';
import configureStore from './store/configureStore.jsx';
import { syncHistoryWithStore, routerReducer} from 'react-router-redux';
import App from './components/App.jsx';
import Home from './components/home.jsx';
import ProjectIndex from './pages/projectIndex.jsx';
import SignIn from './components/SignInForm.jsx';
//for React Developer Tools
window.React = React;
const store = configureStore();
const history = syncHistoryWithStore(browserHistory, store)
injectTapEventPlugin();
render(
<MuiThemeProvider muiTheme={theme}>
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component = {Home} />
<Route path="/home" component={Home} />
<Route path="/project" component={ProjectIndex} />
<Route path="/signin" component={SignIn} />
<Route path="*" component={NotFoundPage}/>
</Route>
</Router>
</Provider>
</MuiThemeProvider>
, document.getElementById('body')
);
而且App.jsx代碼: -
class App extends Component {
constructor(props){
super(props)
this.state = {
logged: false,
};
}
render() {
return (
<div className="page_container">
<div>
<AppBar
title="Issue Tracker"
iconElementRight={<Logged />}
/>
</div>
<div>
{this.props.children}
</div>
</div>
);
}
}
export default App;
而且Home.jsx代碼: -
import React ,{Component} from 'react';
class Home extends Component{
constructor(props){
super(props)
}
render(){
return(
<div>
<h1>Hi this is home</h1>
</div>
)
}
}
export default Home;
任何幫助將是巨大的。 感謝
我們需要查看組件的代碼,並可能需要查看問題的屏幕截圖。你提供的代碼是不夠的。 –