Coder Social home page Coder Social logo

Comments (8)

ankeetmaini avatar ankeetmaini commented on July 25, 2024

Could you figure this out? Is it sorted now?

from react-infinite-scroll-component.

bogdan8 avatar bogdan8 commented on July 25, 2024

@ankeetmaini sorry I thought this module for react-native)

from react-infinite-scroll-component.

ankeetmaini avatar ankeetmaini commented on July 25, 2024

No it should work just fine. I've not tested it. But the error seems like you're passing an object instead of a Component. Could you try storing the divs in a state variable and then pass just the variable.

<InfiniteScroll 
  pullDownToRefresh
  pullDownToRefreshContent={<h3 style={{textAlign: 'center'}}>&#8595; Pull down to refresh</h3>}
  releaseToRefreshContent={<h3 style={{textAlign: 'center'}}>&#8593; Release to refresh</h3>}
  refreshFunction={this.refresh}
  next={this.generateDivs}
  hasMore={true}
  loader={<h4>Loading...</h4>}>
  
  {this.state.someVariableContainingListOfDivs}

</InfiniteScroll>

from react-infinite-scroll-component.

bogdan8 avatar bogdan8 commented on July 25, 2024

@ankeetmaini so if you write it as a bug

const divs = [
    <div key={2} style={{height: 200, background: '#ffd47b'}}>Div no 2</div>,
    <div key={1} style={{height: 200, background: '#9bc95b'}}>Div no 1</div>,
    <div key={3} style={{height: 200, background: '#95a9d6'}}>Div no 3</div>,
    <div key={4} style={{height: 200, background: '#ffa8e1'}}>Div no 4</div>,
    <div key={5} style={{height: 200, background: '#9bc95b'}}>Div no 5</div>,
    <div key={6} style={{height: 200, background: '#ffd47b'}}>Div no 6</div>,
    <div key={7} style={{height: 200, background: '#95a9d6'}}>Div no 7</div>,
    <div key={8} style={{height: 200, background: '#ffa8e1'}}>Div no 8</div>,
  ];

class Home extends Component {
  state = {
    modalVisible: false,
    choseCategory: '',
    per: 2,
    someVariableContainingListOfDivs: divs
  };

from react-infinite-scroll-component.

ankeetmaini avatar ankeetmaini commented on July 25, 2024

Yes, this way, does this work? Or still the same error?

from react-infinite-scroll-component.

bogdan8 avatar bogdan8 commented on July 25, 2024

@ankeetmaini I get the same error Expected a component class, got [object Object]

from react-infinite-scroll-component.

bogdan8 avatar bogdan8 commented on July 25, 2024

@ankeetmaini I even tried to copy the example https://github.com/ankeetmaini/react-infinite-scroll-component/blob/master/demos/height.js and still this error

from react-infinite-scroll-component.

ankeetmaini avatar ankeetmaini commented on July 25, 2024

from react-infinite-scroll-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.