Commit 565bb579 authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by Guillermo Rauch

Update url.pushTo and url.replaceTo update only on dev. (#434)

In order to warn the user, now we are using a warn function
which is located in the lib/utils module.
parent ff7e128c
import React, { Component, PropTypes } from 'react' import React, { Component, PropTypes } from 'react'
import { AppContainer } from 'react-hot-loader' import { AppContainer } from 'react-hot-loader'
import { warn } from './utils'
export default class App extends Component { export default class App extends Component {
static childContextTypes = { static childContextTypes = {
...@@ -67,7 +68,7 @@ function propsToState (props) { ...@@ -67,7 +68,7 @@ function propsToState (props) {
back: () => router.back(), back: () => router.back(),
push: (url, as) => router.push(url, as), push: (url, as) => router.push(url, as),
pushTo: (href, as) => { pushTo: (href, as) => {
console.warn(`Warning: 'url.pushTo()' is deprecated. Please use 'url.push()' instead.`) warn(`Warning: 'url.pushTo()' is deprecated. Please use 'url.push()' instead.`)
const pushRoute = as ? href : null const pushRoute = as ? href : null
const pushUrl = as || href const pushUrl = as || href
...@@ -75,7 +76,7 @@ function propsToState (props) { ...@@ -75,7 +76,7 @@ function propsToState (props) {
}, },
replace: (url, as) => router.replace(url, as), replace: (url, as) => router.replace(url, as),
replaceTo: (href, as) => { replaceTo: (href, as) => {
console.warn(`Warning: 'url.replaceTo()' is deprecated. Please use 'url.replace()' instead.`) warn(`Warning: 'url.replaceTo()' is deprecated. Please use 'url.replace()' instead.`)
const replaceRoute = as ? href : null const replaceRoute = as ? href : null
const replaceUrl = as || href const replaceUrl = as || href
......
import { warn } from './utils'
const css = require('glamor') const css = require('glamor')
if (process.env.NODE_ENV !== 'production') { warn('Warning: \'next/css\' is deprecated. Please use styled-jsx syntax instead.')
console.error('Warning: \'next/css\' is deprecated. Please use styled-jsx syntax instead.')
}
/** /**
* Expose style as default and the whole object as properties * Expose style as default and the whole object as properties
......
export function warn (message) {
if (process.env.NODE_ENV !== 'production') {
console.error(message)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment