反応したReduxを習得しようとして失敗した小道具タイプに問題があります。 タイトルとテキストを含むメモを作成したいのですが、失敗した小見出しの種類のため、タイトルのみが表示されます。React Reduxが失敗しましたprop type:必須の小道具が指定されていません
警告:
warning.js:36 Warning: Failed prop type: Required prop `notes[0].text` was not specified in `NoteList`.
in NoteList (created by Connect(NoteList))
in Connect(NoteList) (created by App)
in div (created by App)
in App
in Provider
warning.js:36 Warning: Failed prop type: Required prop `text` was not specified in `Note`.
in Note (created by NoteList)
in NoteList (created by Connect(NoteList))
in Connect(NoteList) (created by App)
in div (created by App)
in App
in Provider
ListNotes.js:
import { connect } from 'react-redux'
import NotesList from '../components/NotesList'
const mapStateToProps = (state) => {
return {
notes: state.notes
}
}
const ListNotes = connect(
mapStateToProps
)(NotesList)
export default ListNotes
NotesList.js:
import React, { PropTypes } from 'react'
import Note from './Note'
const NoteList = ({ notes }) => {
return (
<ul>
{notes.map(note =>
<note
key={note.id}
{...note}
/>
)}
</ul>
)
}
NoteList.propTypes = {
notes: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
text: PropTypes.string.isRequired
}).isRequired).isRequired
}
export default NoteList
Note.js:
import React, { PropTypes } from 'react'
const Note = ({title, text}) => {
return (
<li>
<h1>{title}</h1>
<p>{text}</p>
</li>
)
}
Note.propTypes = {
title: PropTypes.string.isRequired,
text: PropTypes.string.isRequired
}
export default Note
' ' ' 'はどういう意味ですか? –