dantrain / react-stonecutter

Animated grid layout component for React
http://dantrain.github.io/react-stonecutter
MIT License
1.21k stars 72 forks source link

React components as Grid children #18

Closed mishoboss closed 7 years ago

mishoboss commented 7 years ago

Looks like it expects DOM elements only and when React components supplied as children, there is an error shown KeyEscapeUtils.js?ac04:28 Uncaught RangeError: Maximum call stack size exceeded

rafaelcorreiapoli commented 7 years ago

Any updates on this? @dantrain

dantrain commented 7 years ago

I'm not sure what to do about this, the grid needs to be able to update its children's style prop. Perhaps I could pass the new styles through but then you'd have to muck about applying them in your own component, and it would no longer be reusable. I could wrap children in <div>s automatically but what if you wanted a different tag name or certain attributes?

For now I have updated the Readme to suggest wrapping your components:

<SpringGrid
  component="ul"
  // ...etc.
>
  {data.map((datum) => (
    <li key={datum.id}>
      <MyComponent datum={datum} />
    </li>
  ))}
</SpringGrid>

In the next release I will check and throw friendly errors explaining the need to do this so no more stack overflow hopefully!

Any better ideas?