Comments (4)
Should get around to making an FAQ on the README because every other issue I get for this package is about overflow-y
or clear
from react-infinite-scroller.
Working now man
style={{overflowY: 'auto', height: '100vh'}}
Thank you ! :)
from react-infinite-scroller.
First off, when you call setState
you don't need to pass in the whole state with ...this.state
. On your behalf, React uses something like Object.assign
to merge the new state you set with the current state - However, it doesn't clone deeply so if you're adding to an object, it's fine at that point to use the spread operator: setState({ obj: { ...this.state.obj, newItem } })
.
Also, don't use the ++
incrementer with setState
, because, again, you're mutating pageStart
instead of setting, if you need lines like that make sure to use { pageStart: this.state.pageStart + 1 }
.
I think the actual problem with why it's not updating is because you're not meant to update the pageStart
prop. If you want to keep a record of which page your on yourself, keep page
in your state and update it in your loadMore
. If you want InfiniteScroller to manage your pagination, use the page
parameter that is given to loadMore
// this.state.page = 0
loadMore() {
const nextPage = this.state.page + 1;
this.setState({ page: nextPage });
request.get(`/search?page=${nextPage}`)
}
-- or --
loadMore(page) {
request.get(`/search?page=${page}`)
}
from react-infinite-scroller.
I tried like you said to me. No luck. loadMore is not called at all. Weird...
This is my code:
import React, { PropTypes, Component } from 'react'
import { injectIntl, intlShape } from 'react-intl'
import { Card, CardText, List, ListItem } from 'react-toolbox'
import { Loader } from '../../../commons'
import InfiniteScroll from 'react-infinite-scroller'
import moment from 'moment'
class UserActivityItemsList extends Component {
constructor(props) {
super(props)
this.state = {
hasMore: true,
pageStart: 0
}
}
loadMore() {
console.log('------> LOAD MORE')
const nextPage = this.state.pageStart + 1
this.setState({
pageStart: nextPage
})
}
render() {
return (
Loading ... } >
{ items }
)
}
}
UserActivityItemsList.propTypes = {
intl: intlShape
}
export default injectIntl(UserActivityItemsList)
JSX is not interpreted correctly here...
Thank you man
from react-infinite-scroller.
Related Issues (20)
- Imports failure while building with Vite HOT 1
- Is it possible to reset the start page when requesting new data or switching the filter? HOT 2
- bug: changing hasMore before you scroll down doesnt update component HOT 1
- useWindow={true} not working HOT 2
- loadmore and then, scroll return the firstpage HOT 1
- Support TypeScript HOT 1
- New data doesn't get fetched when there´s no scrollbar HOT 4
- Upgrading to React 18 breaks remove event listeners. HOT 7
- support virtual dom HOT 2
- Pull to refresh not works on latest versions HOT 1
- Add feature to render it as a React Fragment with the element prop HOT 1
- Why is `page` prop called `page`?
- Virtual dom
- How to pull up the element and get data from last page?
- getScrollParent doesn't work with ref, but works with id HOT 1
- RollupError: "default" is not exported by "node_modules/react-infinite-scroller/index.js"
- isReverse broken with combination of column-reverse HOT 4
- Warning: Each child in a list should have a unique "key" prop. HOT 1
- Installation Error Not compatible for react version 18 HOT 2
- Project is still maintained?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-infinite-scroller.