onefinestay / react-lazy-render

Lazy render for (very) large lists of data
Other
208 stars 23 forks source link

LazyRender(...): No `render` method found on the returned component instance #8

Open frg opened 9 years ago

frg commented 9 years ago

I'm getting this error when trying to implement lazy render. Is anyone able to help me out?

lazy render error

Thanks in advance! -- Jean

jkimbo commented 9 years ago

@frg can you post how you are using the component? Also what version of React?

frg commented 9 years ago

0.13 ill get you an example of the code later on in the day.

Thanks for helping!

JoshSGman commented 9 years ago

+1

jkimbo commented 9 years ago

@JoshSGman an example to reproduce this bug would really help!

jhusain commented 8 years ago

+1

Same error.

var React = require('react');
var ReactDOM = require('react-dom');
var LazyRender = require('react-lazy-render');

window.onload = function() {

    var Main = React.createClass({
      render: function() {
            var input = ["what", "the", "heck", "there", "I", "don't", "know"]

            var children = [];
            for (var i = 0; i < input.length; i++) {
              // each child must have a consistent height
              children.push(
                <div style={{ height: 20 }}>
                  #{input[i]}
                </div>
              );
            }
        return <LazyRender maxHeight={300} className="my-list">
          {children}
        </LazyRender>
      }
    });

    ReactDOM.render(<Main />, document.getElementById('test'));

};

HTML:

<!DOCTYPE html>
<html>
<head>
<script src="output.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
    <div id="test" style="width:500px;height:500px;background-color:pink;overflow:scroll">
    </div>
</body>
</html>