import React, { Component } from 'react';
import Notifications from './Notifications';
import ProjectList from '../projects/ProjectList';
import { connect } from 'react-redux';
import { firebaseConnect } from 'react-redux-firebase';
import { compose } from 'redux';
import { Redirect } from 'react-router-dom';
class Dashboard extends Component {
render() {
const { posts, auth } = this.props;
// if (!auth.uid) return <Redirect to="/signin" />;
return (
<div className="dashboard container">
<div className="row">
<div className="col s12 m6 ">
<ProjectList posts={posts} />
</div>
<div className="col s12 m5 offset-m1">
<Notifications />
</div>
</div>
</div>
);
}
}
const mapStateToProps = state => {
return {
posts: state.firebase.ordered.Posts,
auth: state.firebase.auth
};
};
export default compose(
connect(mapStateToProps),
firebaseConnect([{ path: 'Posts' }])
)(Dashboard);
我使用react-redux-firebase firebaseConnect从firebase实时数据库加载帖子。
问题是当我要延迟加载(无限滚动)时,它一次加载所有帖子。