diff --git a/examples/using-router/components/Header.js b/examples/using-router/components/Header.js index acc6d1de8da6d5f37c5e5fa198dc51f2c7da6d06..55415478824c29cbfa5c2181ea21adabea701640 100644 --- a/examples/using-router/components/Header.js +++ b/examples/using-router/components/Header.js @@ -2,30 +2,30 @@ import Router from 'next/router' export default () => (
- Home - About - Error + Home + About + Error
) // typically you want to use `next/link` for this usecase // but this example shows how you can also access the router // and use it manually -const Link = ({ children, href }) => ( - { - e.preventDefault() - Router.push(href) - }} - > - { children } - -) -const styles = { - a: { - marginRight: 10 +function onClickHandler (href) { + return (e) => { + e.preventDefault() + Router.push(href) } } + +const Link = ({ children, href }) => ( + + {children} + + +) diff --git a/examples/using-router/pages/error.js b/examples/using-router/pages/error.js index fb6bded69412a2f9e5b325d924b05066ea726a22..3333b09e2c0fe371062c1e1867c6bcaf442d9698 100644 --- a/examples/using-router/pages/error.js +++ b/examples/using-router/pages/error.js @@ -1,16 +1,19 @@ -import React from 'react' +import {Component} from 'react' import Header from '../components/Header' import Router from 'next/router' -const ErrorPage = ({ aa }) => ( -
-
-

This should not be rendered via SSR

-
-) +export default class extends Component { + static getInitialProps () { + console.log(Router.pathname) + return {} + } -ErrorPage.getInitialProps = () => { - console.log(Router.pathname) + render () { + return ( +
+
+

This should not be rendered via SSR

+
+ ) + } } - -export default ErrorPage