我有分量,这需要渲染之前获取服务器数据:关于空支柱的警告:为什么会发生?
class BooksManage extends Component {
componentWillMount() {
const { dispatch, fetchManagePage } = this.props
dispatch(fetchManagePage())
}
render() {
const sections = this.props.books.map((section, index) => {
return (
<div className='row' key={index}>
<BookSectionContainer index={index} />
</div>
)
})
return (
<div className='row'>
<div className='col-md-8'>
{sections}
<BookPaginationContainer paginationClass='books' />
</div>
<div className='col-md-3'>
<div style={{position: 'fixed', width: 'inherit'}}>
<EmployeesListContainer />
</div>
</div>
</div>)
}
}
正如你所看到的,它使用BookPaginationContainer
,其预计几个状态参数:
Warning: Failed prop type: The prop `currentPage` is marked as required in `Paginate`, but its value is `undefined`.
等等
问题:由于BookPaginationContainer
是BooksManage
的孩子,我期望通过componentWillMount()
实现的是分派动作获取需要的状态参数。
实际发生的:
action REQUEST_MANAGE_PAGE @ 18:41:49.770
Warning: Failed prop type: The prop `currentPage` is marked as required in `Paginate`, but its value is `undefined`.
action RECEIVE_MANAGE_PAGE @ 19:01:40.327
所有页面后呈现正确,但我关心的是如何好这一点。
“Paginate”组件在哪里。 –