Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

react-infinite doesn't re-render the list, if a item is deleted from the list. The view gets updated when i scroll back and forth #253

@ajit100

Description

@ajit100

How do I force react-infinite to rerender my list, When i deleted one item from the list.

For example :

import React, { Component } from 'react'
import InfiniteList from 'react-infinite';
export default class componentName extends Component {
constructor(){
this.state{
list:[]
}
}

fillList(){
list.push(1);list.push(2)....
}

DeleteItem(){
let x = this.state.list.slice();
x.splice(0,1);
this.setState({list,x});

// so now due to somereason i deleted 1 item , How do now the InfiniteList rerender the list again.
// current behaviour is it doesn't delete that item immediately, But when i scroll back and forth i see //the new list
//Question is how to force inifinite list to re-render it immediately.
}
renderlist(){
return this.state.list.map((item)=>

{item}

);
}
render() {
return (


{this.renderList()} . // when list gets updated, changes are not reflected immediately


)
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions