Extract Header component from App component
authorFrank Bessou <frank.bessou@logilab.fr>
Mon, 24 Apr 2017 10:54:15 +0200
changeset 130 e0bb0419cbc4
parent 129 ce4947aeebc1
child 131 8b57e0779065
Extract Header component from App component
src/components/App.js
--- a/src/components/App.js	Mon Apr 24 10:53:47 2017 +0200
+++ b/src/components/App.js	Mon Apr 24 10:54:15 2017 +0200
@@ -2,7 +2,21 @@
 import NavLink from './NavLink';
 
 export function App(props) {
-    const header = (
+    return (
+        <div>
+            <Header />
+            <div className="container">
+                {props.children}
+            </div>
+        </div>
+    );
+}
+App.propTypes = {
+    children: React.PropTypes.object,
+};
+
+export function Header() {
+    return (
         <nav className="navbar navbar-default">
             <div className="container-fluid">
                 <div className="collapse navbar-collapse">
@@ -16,19 +30,8 @@
                 </div>
             </div>
         </nav>
-    );
-    return (
-        <div>
-            {header}
-            <div className="container">
-                {props.children}
-            </div>
-        </div>
-    );
+   )
 }
-App.propTypes = {
-    children: React.PropTypes.object,
-};
 
 export function NotFound() {
     return (