Consider refactoring <Table /> not to use children prop for column specification
See original GitHub issueI’m working on a datatable implementation which is based off (forks) <Table />
code.
I think <Table />
code itself could be simplified (and even be more performant probably) if it uses columns
prop (being an array column specifications, just POJSO objects) instead of children
with pseudo-React elements.
For example all those calls to React.Children.forEach/map
will go away. What do you think?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Why is React saying "Invalid prop `children`"? - Stack Overflow
It appears that rendering a single child in react follows different semantics than rendering multiple children and PropTypes should be updated accordingly.
Read more >Tested React: Let's build a Data Table | by Gasim Gasimzada
In our case, it doesn't really matter because DataTable component cannot have children.
Read more >Specification, Implementation and Verification of Refactorings
Refactoring is the process of reorganising or restructuring code by means of behaviour-preserving program transformations, themselves called refactorings.
Read more >Breaking changes in v5, part two: core components - Material UI
As the core components use Emotion as their style engine, the props used by ... they are considered deprecated CSS properties by the...
Read more >Table | Element Plus
After setting attribute data of el-table with an object array, you can use prop (corresponding to a key of the object in data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is a reasonable suggestion though. I’ll think on it a bit more. If you’d like to toss up a PR with a suggested implementation in the meanwhile- (one that maintains backwards compat)- I’d be happy to look over it and further consider.
lol, no worries. I understood what you meant. 😄