我有反應組分與構造:對象屬性總是返回undefined
constructor(props) {
super(props);
console.log(props.user);
console.log(props.user.email);
}
OUTPUT:
{"id":7,"email":"[email protected]","locale":"en","hp":100,"created_at":"2017-10-10T20:42:04.677Z","updated_at":"2017-10-10T21:35:22.297Z"}
undefined
試試'props.user [ '電子郵件']' – xDreamCoding
@cfraser我規定的props.user輸出,並且它是一個對象。請閱讀這個問題。 – Src
@xDreamCoding相同 – Src