From c8bf63e72c33f5ec9480f53cfa1e0a8d6ae70cc5 Mon Sep 17 00:00:00 2001 From: Lionel Date: Wed, 16 May 2018 12:35:27 +0200 Subject: [PATCH] Update with-url-object-routing (#4314) Use `withRouter` HOC to avoid _deprecation warning_ using `url` --- examples/with-url-object-routing/pages/about.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/with-url-object-routing/pages/about.js b/examples/with-url-object-routing/pages/about.js index 8d71f488..b2f03a68 100644 --- a/examples/with-url-object-routing/pages/about.js +++ b/examples/with-url-object-routing/pages/about.js @@ -1,6 +1,6 @@ import React from 'react' import Link from 'next/link' -import Router from 'next/router' +import Router, { withRouter } from 'next/router' const href = { pathname: '/about', @@ -14,10 +14,10 @@ const as = { const handleClick = () => Router.push(href, as) -export default (props) => ( +export default withRouter(({ router: { query } }) => (
-

About {props.url.query.name}

- {props.url.query.name === 'zeit' ? ( +

About {query.name}

+ {query.name === 'zeit' ? ( Go to home page @@ -25,4 +25,4 @@ export default (props) => ( )}
-) +))