-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce the new App and Layout components. Upgrade
history
module…
…. (#869) * Introduce the new App and Layout components. Upgrade `history` module. * Some clean up and farther improvements
- Loading branch information
Showing
23 changed files
with
387 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* React Starter Kit (https://www.reactstarterkit.com/) | ||
* | ||
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE.txt file in the root directory of this source tree. | ||
*/ | ||
|
||
import React, { PropTypes } from 'react'; | ||
|
||
const ContextType = { | ||
// Navigation manager, e.g. history.push('/home') | ||
// https://github.com/mjackson/history | ||
history: PropTypes.object.isRequired, | ||
// Enables critical path CSS rendering | ||
// https://github.com/kriasoft/isomorphic-style-loader | ||
insertCss: PropTypes.func.isRequired, | ||
}; | ||
|
||
/** | ||
* The top-level React component setting context (global) variables | ||
* that can be accessed from all the child components. | ||
* | ||
* https://facebook.github.io/react/docs/context.html | ||
* | ||
* Usage example: | ||
* | ||
* const context = { | ||
* history: createBrowserHistory(), | ||
* store: createStore(), | ||
* }; | ||
* | ||
* ReactDOM.render(<App context={context}><HomePage /></App>, container); | ||
*/ | ||
class App extends React.Component { | ||
|
||
static propTypes = { | ||
context: PropTypes.shape(ContextType).isRequired, | ||
children: PropTypes.element.isRequired, | ||
}; | ||
|
||
static childContextTypes = ContextType; | ||
|
||
getChildContext() { | ||
return this.props.context; | ||
} | ||
|
||
render() { | ||
// NOTE: If you need to add or modify header, footer etc. of the app, | ||
// please do that inside the Layout component. | ||
return React.Children.only(this.props.children); | ||
} | ||
|
||
} | ||
|
||
export default App; |
Oops, something went wrong.