0

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 实时数据库加载帖子。

问题是它一次加载所有帖子,当我想要延迟加载(无限滚动)时。

4

0 回答 0