question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating a custom Column using composition instead of inheritance?

See original GitHub issue

Are there any plans to support using composition of Column in Table? Seems like Table is very strict about children types seen here.

I ask because it seems like composition is preferred over inheritance in React… I want to create custom column components and right now I find myself having to extend Column instead of React.Component.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rmehlingercommented, Apr 11, 2019

Personally I think table should be changed to allow custom column components. React specifically discourages the use of inheritance, and anyway you can’t use it with functional components, which is the direction things are heading. One option might be to search descendants of children components and ensure that all leaves are Columns?

1reaction
bvaughncommented, Dec 17, 2017

I think we talked about this out of band (maybe over Slack?) I can’t recall. Anyway, I don’t think this is necessary.

You can extend Column, use a cellRenderer, or a shared factory method that creates pre-configured Column instances for you. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Composition vs. Inheritance: How to Choose? | Thoughtworks
Inheritance is transitive, so a class may inherit from another class which inherits from another class, and so on, up to a base...
Read more >
Prefer composition over inheritance? - Stack Overflow
Prefer composition over inheritance as it is more malleable / easy to modify later, but do not use a compose-always approach. With composition,...
Read more >
4 12 Composition vs Inheritance Building Flutter Widgets From ...
Composition vs Inheritance Building Flutter Widgets From ScratchInheritance and polymorphism in FlutterThe Flutter UI framework, ...
Read more >
Composition over Inheritance, why not both?
Composition over Inheritance, why not both? The principle is correctly quoted as "prefer composition over inheritance".
Read more >
Inheritance versus composition - LWN.net
With composition, one can create a class that has relationships with ... inheritance in coding & inheritance means reuse of codes instead of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found