最新版的代码在PropTypes 和RouterContext 处会抛错?
直接clone 代码,安装完npm packages 后运行 npm run dev,控制台会抛以下warning,貌似是因为react 官方不再推荐这种用法?
Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.

Warning: RouterContext: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.

是的,
一:
npm install prop-types
import React from 'react'
import PropTypes from 'prop-types'
二:
const App = React.createClass({
})
推荐写成
class App extends React.Componnet {
}
但是有的是在依赖里面的,改不到
@zuiidea ˊ_>ˋ 有计划这个什么时候修吗?
我这里面没有React.createClass这种写法啊,'prop-types'也都换了,依赖里面的写法改不着,只能想办法去掉这个warning了
+1,好好的升级了各种报错,这种升级能说是良性升级么
估计是ant design的依赖包里的。
我是一直在登录页面转啊转,用户名密码没有输错 但是就是不跳转到其它页面
@yashi-david 看README上的注意啊
我已经注意过了 ,但是就是跳不出登录页面,求助啊
@yashi-david 问题是什么啊,报错是什么啊
除了楼上说的两个警告,没有其它的报错,问题就是输入用户名密码点击登录后,过一会就只是刷新了当前的登录页面,所以进不了后台
@yashi-david 你清一下cookie 和 localStorage?估计是token 被污染了
解决了!就是这个问题,我的妈呀~
不科学啊,就算cookie有错,登录时会重置cookie,讲道理不至于进不去呢
@zuiidea 我找到登录无反应的原因了,cookie 确实会重置,但当cookie 里不止 一个项时, cookie 的值是 PHPSESSID=aek8ecjn23t111879pldv0umu2; token=%7B%22id%22%3A1%2C%22deadline%22%3A1493349739100%7D
使用 const cookies = qs.parse(req.headers.cookie, { delimiter: ';' }) 解析,会得到
cookies ={ PHPSESSID: 'aek8ecjn23t111879pldv0umu2', ' token': '{"id":1,"deadline":1493349739100}' }
token 前面会有个空格,所以mock/users.js 中 [' GET /userInfo '] 中获取 cokies.token 的值为空,然后会抛 'Not Login',然后一直死循环了。
只要 parse 时 delimiter 的值添加个空格就可以fix 了
const cookies = qs.parse(req.headers.cookie, { delimiter: '; ' })
@IssaTan1990,qs.parse(cookie.replace(/\s/g, ''), { delimiter: ';' })
这个已经改过了,先去空格
重写console.error (function () { var __oldConsoleError = window.console.error.bind(console); window.console.error = function(message) { if (message === "Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead." || "Warning: A Component: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.") { return false; } __oldConsoleError(message); } })();
@jackple 虽然不优雅,但是很好用,哈哈哈哈哈😁😁😁