当我这样做时
AdminDashboard.propTypes = {
users: PropTypes.object.isRequired
};
我从反应中得到了这个警告
Warning: Failed prop type: Invalid prop users of type array supplied to AdminDashboard, expected object.
然后我改为
AdminDashboard.propTypes = {
users: PropTypes.array.isRequired
};
我得到了这个
Warning: Failed prop type: Invalid prop `users` of type `object` supplied to `AdminDashboard`, expected `array`.
你想要什么,做出反应?
更新:
我的用户看起来像这样
[{
"_id": "5904176e9ca7649b1eae",
"name": "Ching",
"university": "Havard",
"member_since": "2017-04-29T04:14:09.545Z",
}]