redux-logger.js:408 error TypeError: Cannot read properties of null (reading ‘username’)
at ArticleItem. (articleItem.js:102:1)
at Array.map ()
at ArticleItem.render (articleItem.js:47:1)
at finishClassComponent (react-dom.development.js:17098:1)
at updateClassComponent (react-dom.development.js:17051:1)
at beginWork (react-dom.development.js:18513:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:189:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:238:1)
at invokeGuardedCallback (react-dom.development.js:291:1)
at beginWork$1 (react-dom.development.js:23055:1)
at performUnitOfWork (react-dom.development.js:22022:1)
at workLoopSync (react-dom.development.js:21995:1)
at performSyncWorkOnRoot (react-dom.development.js:21613:1)
at react-dom.development.js:11131:1
at unstable_runWithPriority (scheduler.development.js:659:1)
at runWithPriority$1 (react-dom.development.js:11077:1)
at flushSyncCallbackQueueImpl (react-dom.development.js:11126:1)
at flushSyncCallbackQueue (react-dom.development.js:11114:1)
at scheduleUpdateOnFiber (react-dom.development.js:21056:1)
at Object.enqueueSetState (react-dom.development.js:12676:1)
at push…/node_modules/_react@16.14.0@react/cjs/react.development.js.Component.setState (react.development.js:464:1)
at Connect.onStateChange (connectAdvanced.js:205:1)
at dispatch (redux.js:298:1)
at redux-logger.js:458:1
at index.js:20:1
at dispatch (redux.js:694:1)
at action.js:54:1
TypeError: Cannot read properties of null (reading ‘username’)
{
v.author&&
v.user&& // 我这里是这句不能不加 ,必须 判断 v.user不为空,才能去获取 v.user.username
v.author.length > 0 && v.author != 'None' ?
<Link to={"/user/" + v.user.username} className="author-media-avatar">
<img src={v.user.avatar} alt=""/>
</Link>
:
null
}