Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New syntax as an HOC #37

Closed
developerdizzle opened this issue Jan 26, 2017 · 0 comments
Closed

New syntax as an HOC #37

developerdizzle opened this issue Jan 26, 2017 · 0 comments

Comments

@developerdizzle
Copy link
Owner

Experimenting with a new architecture as an HOC. I like this as it gives more control to the consumer. One question I've been thinking about is which options, if any, to use as HOC parameters vs properties?

// the HOC

import VirtualList from 'react-virtual-list';

// your component

const MyList = ({
  virtual,
  itemHeight,
}) => (
  <ul style={virtual.style}>
    {virtual.items.map((item) => (
      <li key={`item${item.id}`} style={{height: itemHeight }}>
        Lorem ipsum dolor sit amet
      </li>
    ))}
  </ul>
);

// using the HOC - which options, if any, should go in here?

const options = {
  scrollThrottle: 1000,
};

const MyVirtualList = VirtualList(options)(MyList);

// rendering - which options should be props here?

<MyVirtualList
  items={myBigListOfItems}
  container={window}
  itemBuffer={0}
  itemHeight={100}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant