1

I'm currently writing a paper on my react frontend and I'm struggeling to find the right verb for the interaction between child-components and components in react.

For example:

"I have a table component which ?inherits? from the child components tableHeader and tableBody."

Is the use of inheritance correct here or how should I describe it?

EDIT: Here is a example code of my table

import React from 'react';
import TableHeader from './tableHeader';
import TableBody from './tableBody';

// Stateless Functional Component

const Table = ({ columns, sortColumn, onSort, data }) => {
  return (
    <table className="table">
       <TableHeader
          columns={columns}
          sortColumn={sortColumn}
          onSort={onSort}
       />
       <TableBody columns={columns} data={data} />
    </table>
  );
};



export default Table;

1 Answer 1

1

Inheriting from children is highly unnatural :) I would say that a Table component likely wraps or contains TableHeader and TableBody components, and renders them as its children.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.