-
-
-

-
Your Company
-
-
-
React
-
Complex web apps made easy
-
+export default function Header() {
+ useStyles(s);
+ return (
+
+
+
+
+

+
Your Company
+
+
+
React
+
Complex web apps made easy
- );
- }
+
+ );
}
-
-export default withStyles(s)(Header);
diff --git a/src/components/Html.js b/src/components/Html.js
index 3adb7b369..fb23d700b 100644
--- a/src/components/Html.js
+++ b/src/components/Html.js
@@ -14,77 +14,79 @@ import config from '../config';
/* eslint-disable react/no-danger */
-class Html extends React.Component {
- static propTypes = {
- title: PropTypes.string.isRequired,
- description: PropTypes.string.isRequired,
- styles: PropTypes.arrayOf(
- PropTypes.shape({
- id: PropTypes.string.isRequired,
- cssText: PropTypes.string.isRequired,
- }).isRequired,
- ),
- scripts: PropTypes.arrayOf(PropTypes.string.isRequired),
- app: PropTypes.object, // eslint-disable-line
- children: PropTypes.string.isRequired,
- };
-
- static defaultProps = {
- styles: [],
- scripts: [],
- };
-
- render() {
- const { title, description, styles, scripts, app, children } = this.props;
- return (
-
-
-
-
-
{title}
-
-
- {scripts.map(script => (
-
- ))}
-
-
- {styles.map(style => (
-
- ))}
-
-
-
+export default function Html({
+ title,
+ description,
+ styles,
+ scripts,
+ app,
+ children,
+}) {
+ return (
+
+
+
+
+
{title}
+
+
+ {scripts.map(script => (
+
+ ))}
+
+
+ {styles.map(style => (
+
+ ))}
+
+
+
+
+ {scripts.map(script => (
+
+ ))}
+ {config.analytics.googleTrackingId && (
- {scripts.map(script => (
-
- ))}
- {config.analytics.googleTrackingId && (
-
- )}
- {config.analytics.googleTrackingId && (
-
- )}
-
-
- );
- }
+ )}
+ {config.analytics.googleTrackingId && (
+
+ )}
+
+
+ );
}
-export default Html;
+Html.propTypes = {
+ title: PropTypes.string.isRequired,
+ description: PropTypes.string.isRequired,
+ styles: PropTypes.arrayOf(
+ PropTypes.shape({
+ id: PropTypes.string.isRequired,
+ cssText: PropTypes.string.isRequired,
+ }).isRequired,
+ ),
+ scripts: PropTypes.arrayOf(PropTypes.string.isRequired),
+ app: PropTypes.object, // eslint-disable-line
+ children: PropTypes.string.isRequired,
+};
+
+Html.defaultProps = {
+ styles: [],
+ scripts: [],
+};
diff --git a/src/components/Layout/Layout.js b/src/components/Layout/Layout.js
index 05b8d957e..769e5c317 100644
--- a/src/components/Layout/Layout.js
+++ b/src/components/Layout/Layout.js
@@ -7,9 +7,9 @@
* LICENSE.txt file in the root directory of this source tree.
*/
+import useStyles from 'isomorphic-style-loader/useStyles';
import React from 'react';
import PropTypes from 'prop-types';
-import withStyles from 'isomorphic-style-loader/withStyles';
// external-global styles must be imported in your JS.
import normalizeCss from 'normalize.css';
@@ -18,21 +18,18 @@ import Header from '../Header';
import Feedback from '../Feedback';
import Footer from '../Footer';
-class Layout extends React.Component {
- static propTypes = {
- children: PropTypes.node.isRequired,
- };
-
- render() {
- return (
-
-
- {this.props.children}
-
-
-
- );
- }
+export default function Layout({ children }) {
+ useStyles(s, normalizeCss);
+ return (
+ <>
+
+ {children}
+
+
+ >
+ );
}
-export default withStyles(normalizeCss, s)(Layout);
+Layout.propTypes = {
+ children: PropTypes.node.isRequired,
+};
diff --git a/src/components/Layout/__snapshots__/Layout.test.js.snap b/src/components/Layout/__snapshots__/Layout.test.js.snap
index 8e4e7cb5d..b74690d19 100644
--- a/src/components/Layout/__snapshots__/Layout.test.js.snap
+++ b/src/components/Layout/__snapshots__/Layout.test.js.snap
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Layout renders children correctly 1`] = `
-
+Array [
@@ -84,10 +84,10 @@ exports[`Layout renders children correctly 1`] = `
-